@aws-amplify/storage 6.0.20 → 6.0.21-gen2-storage.7da2b89.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.
Files changed (132) hide show
  1. package/dist/cjs/errors/types/validation.js +18 -2
  2. package/dist/cjs/errors/types/validation.js.map +1 -1
  3. package/dist/cjs/providers/s3/apis/copy.js +1 -13
  4. package/dist/cjs/providers/s3/apis/copy.js.map +1 -1
  5. package/dist/cjs/providers/s3/apis/downloadData.js +11 -36
  6. package/dist/cjs/providers/s3/apis/downloadData.js.map +1 -1
  7. package/dist/cjs/providers/s3/apis/getProperties.js +1 -12
  8. package/dist/cjs/providers/s3/apis/getProperties.js.map +1 -1
  9. package/dist/cjs/providers/s3/apis/getUrl.js +1 -19
  10. package/dist/cjs/providers/s3/apis/getUrl.js.map +1 -1
  11. package/dist/cjs/providers/s3/apis/internal/copy.js +41 -7
  12. package/dist/cjs/providers/s3/apis/internal/copy.js.map +1 -1
  13. package/dist/cjs/providers/s3/apis/internal/getProperties.js +10 -6
  14. package/dist/cjs/providers/s3/apis/internal/getProperties.js.map +1 -1
  15. package/dist/cjs/providers/s3/apis/internal/getUrl.js +13 -6
  16. package/dist/cjs/providers/s3/apis/internal/getUrl.js.map +1 -1
  17. package/dist/cjs/providers/s3/apis/internal/remove.js +20 -7
  18. package/dist/cjs/providers/s3/apis/internal/remove.js.map +1 -1
  19. package/dist/cjs/providers/s3/apis/remove.js +1 -10
  20. package/dist/cjs/providers/s3/apis/remove.js.map +1 -1
  21. package/dist/cjs/providers/s3/apis/server/copy.js +3 -5
  22. package/dist/cjs/providers/s3/apis/server/copy.js.map +1 -1
  23. package/dist/cjs/providers/s3/apis/server/getProperties.js +1 -3
  24. package/dist/cjs/providers/s3/apis/server/getProperties.js.map +1 -1
  25. package/dist/cjs/providers/s3/apis/server/getUrl.js +1 -3
  26. package/dist/cjs/providers/s3/apis/server/getUrl.js.map +1 -1
  27. package/dist/cjs/providers/s3/apis/server/remove.js +1 -3
  28. package/dist/cjs/providers/s3/apis/server/remove.js.map +1 -1
  29. package/dist/cjs/providers/s3/utils/constants.js +3 -1
  30. package/dist/cjs/providers/s3/utils/constants.js.map +1 -1
  31. package/dist/cjs/providers/s3/utils/index.js +5 -1
  32. package/dist/cjs/providers/s3/utils/index.js.map +1 -1
  33. package/dist/cjs/providers/s3/utils/isInputWithPath.js +11 -0
  34. package/dist/cjs/providers/s3/utils/isInputWithPath.js.map +1 -0
  35. package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js +2 -1
  36. package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js.map +1 -1
  37. package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js +31 -0
  38. package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js.map +1 -0
  39. package/dist/esm/errors/types/validation.d.ts +6 -2
  40. package/dist/esm/errors/types/validation.mjs +18 -2
  41. package/dist/esm/errors/types/validation.mjs.map +1 -1
  42. package/dist/esm/providers/s3/apis/copy.d.ts +29 -12
  43. package/dist/esm/providers/s3/apis/copy.mjs +1 -13
  44. package/dist/esm/providers/s3/apis/copy.mjs.map +1 -1
  45. package/dist/esm/providers/s3/apis/downloadData.d.ts +70 -32
  46. package/dist/esm/providers/s3/apis/downloadData.mjs +12 -36
  47. package/dist/esm/providers/s3/apis/downloadData.mjs.map +1 -1
  48. package/dist/esm/providers/s3/apis/getProperties.d.ts +28 -11
  49. package/dist/esm/providers/s3/apis/getProperties.mjs +1 -12
  50. package/dist/esm/providers/s3/apis/getProperties.mjs.map +1 -1
  51. package/dist/esm/providers/s3/apis/getUrl.d.ts +42 -18
  52. package/dist/esm/providers/s3/apis/getUrl.mjs +1 -19
  53. package/dist/esm/providers/s3/apis/getUrl.mjs.map +1 -1
  54. package/dist/esm/providers/s3/apis/internal/copy.d.ts +3 -1
  55. package/dist/esm/providers/s3/apis/internal/copy.mjs +41 -6
  56. package/dist/esm/providers/s3/apis/internal/copy.mjs.map +1 -1
  57. package/dist/esm/providers/s3/apis/internal/getProperties.mjs +11 -6
  58. package/dist/esm/providers/s3/apis/internal/getProperties.mjs.map +1 -1
  59. package/dist/esm/providers/s3/apis/internal/getUrl.mjs +15 -7
  60. package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
  61. package/dist/esm/providers/s3/apis/internal/remove.mjs +21 -7
  62. package/dist/esm/providers/s3/apis/internal/remove.mjs.map +1 -1
  63. package/dist/esm/providers/s3/apis/remove.d.ts +26 -9
  64. package/dist/esm/providers/s3/apis/remove.mjs +1 -10
  65. package/dist/esm/providers/s3/apis/remove.mjs.map +1 -1
  66. package/dist/esm/providers/s3/apis/server/copy.d.ts +31 -2
  67. package/dist/esm/providers/s3/apis/server/copy.mjs +1 -3
  68. package/dist/esm/providers/s3/apis/server/copy.mjs.map +1 -1
  69. package/dist/esm/providers/s3/apis/server/getProperties.d.ts +30 -2
  70. package/dist/esm/providers/s3/apis/server/getProperties.mjs +1 -3
  71. package/dist/esm/providers/s3/apis/server/getProperties.mjs.map +1 -1
  72. package/dist/esm/providers/s3/apis/server/getUrl.d.ts +44 -2
  73. package/dist/esm/providers/s3/apis/server/getUrl.mjs +1 -3
  74. package/dist/esm/providers/s3/apis/server/getUrl.mjs.map +1 -1
  75. package/dist/esm/providers/s3/apis/server/remove.d.ts +28 -2
  76. package/dist/esm/providers/s3/apis/server/remove.mjs +1 -3
  77. package/dist/esm/providers/s3/apis/server/remove.mjs.map +1 -1
  78. package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.d.ts +1 -1
  79. package/dist/esm/providers/s3/apis/uploadData/putObjectJob.d.ts +1 -1
  80. package/dist/esm/providers/s3/types/index.d.ts +3 -3
  81. package/dist/esm/providers/s3/types/inputs.d.ts +29 -7
  82. package/dist/esm/providers/s3/types/options.d.ts +23 -5
  83. package/dist/esm/providers/s3/types/outputs.d.ts +33 -10
  84. package/dist/esm/providers/s3/utils/constants.d.ts +2 -0
  85. package/dist/esm/providers/s3/utils/constants.mjs +3 -1
  86. package/dist/esm/providers/s3/utils/constants.mjs.map +1 -1
  87. package/dist/esm/providers/s3/utils/index.d.ts +2 -0
  88. package/dist/esm/providers/s3/utils/index.mjs +2 -0
  89. package/dist/esm/providers/s3/utils/index.mjs.map +1 -1
  90. package/dist/esm/providers/s3/utils/isInputWithPath.d.ts +2 -0
  91. package/dist/esm/providers/s3/utils/isInputWithPath.mjs +8 -0
  92. package/dist/esm/providers/s3/utils/isInputWithPath.mjs.map +1 -0
  93. package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.d.ts +2 -1
  94. package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs +2 -1
  95. package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs.map +1 -1
  96. package/dist/esm/providers/s3/utils/validateStorageOperationInput.d.ts +5 -0
  97. package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs +29 -0
  98. package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs.map +1 -0
  99. package/dist/esm/types/index.d.ts +2 -2
  100. package/dist/esm/types/inputs.d.ts +42 -8
  101. package/dist/esm/types/options.d.ts +1 -0
  102. package/dist/esm/types/outputs.d.ts +22 -6
  103. package/package.json +107 -107
  104. package/src/errors/types/validation.ts +19 -2
  105. package/src/providers/s3/apis/copy.ts +38 -15
  106. package/src/providers/s3/apis/downloadData.ts +105 -47
  107. package/src/providers/s3/apis/getProperties.ts +38 -15
  108. package/src/providers/s3/apis/getUrl.ts +48 -22
  109. package/src/providers/s3/apis/internal/copy.ts +90 -8
  110. package/src/providers/s3/apis/internal/getProperties.ts +19 -9
  111. package/src/providers/s3/apis/internal/getUrl.ts +29 -11
  112. package/src/providers/s3/apis/internal/remove.ts +28 -10
  113. package/src/providers/s3/apis/remove.ts +35 -12
  114. package/src/providers/s3/apis/server/copy.ts +49 -6
  115. package/src/providers/s3/apis/server/getProperties.ts +48 -6
  116. package/src/providers/s3/apis/server/getUrl.ts +56 -5
  117. package/src/providers/s3/apis/server/remove.ts +46 -5
  118. package/src/providers/s3/apis/uploadData/multipart/uploadHandlers.ts +1 -1
  119. package/src/providers/s3/apis/uploadData/putObjectJob.ts +1 -1
  120. package/src/providers/s3/types/index.ts +26 -5
  121. package/src/providers/s3/types/inputs.ts +64 -18
  122. package/src/providers/s3/types/options.ts +44 -21
  123. package/src/providers/s3/types/outputs.ts +47 -10
  124. package/src/providers/s3/utils/constants.ts +3 -0
  125. package/src/providers/s3/utils/index.ts +2 -0
  126. package/src/providers/s3/utils/isInputWithPath.ts +13 -0
  127. package/src/providers/s3/utils/resolveS3ConfigAndInput.ts +3 -2
  128. package/src/providers/s3/utils/validateStorageOperationInput.ts +39 -0
  129. package/src/types/index.ts +12 -5
  130. package/src/types/inputs.ts +61 -11
  131. package/src/types/options.ts +1 -0
  132. package/src/types/outputs.ts +25 -6
@@ -1 +1 @@
1
- {"version":3,"file":"copy.js","sources":["../../../../../../src/providers/s3/apis/server/copy.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copy = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst copy_1 = require(\"../internal/copy\");\nconst copy = async (contextSpec, input) => {\n return (0, copy_1.copy)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\n};\nexports.copy = copy;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACtB,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC3C,MAAM,IAAI,GAAG,OAAO,WAAW,EAAE,KAAK,KAAK;AAC3C,IAAI,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACrG,CAAC,CAAC;AACF,OAAO,CAAC,IAAI,GAAG,IAAI;;"}
1
+ {"version":3,"file":"copy.js","sources":["../../../../../../src/providers/s3/apis/server/copy.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.copy = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst copy_1 = require(\"../internal/copy\");\nconst copy = (contextSpec, input) => (0, copy_1.copy)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.copy = copy;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACtB;AACA;AACA,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC3C,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC/H,OAAO,CAAC,IAAI,GAAG,IAAI;;"}
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getProperties = void 0;
7
7
  const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
8
8
  const getProperties_1 = require("../internal/getProperties");
9
- const getProperties = (contextSpec, input) => {
10
- return (0, getProperties_1.getProperties)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
11
- };
9
+ const getProperties = (contextSpec, input) => (0, getProperties_1.getProperties)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
12
10
  exports.getProperties = getProperties;
13
11
  //# sourceMappingURL=getProperties.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getProperties.js","sources":["../../../../../../src/providers/s3/apis/server/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst getProperties_1 = require(\"../internal/getProperties\");\nconst getProperties = (contextSpec, input) => {\n return (0, getProperties_1.getProperties)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\n};\nexports.getProperties = getProperties;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAC7D,MAAM,aAAa,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK;AAC9C,IAAI,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACvH,CAAC,CAAC;AACF,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
1
+ {"version":3,"file":"getProperties.js","sources":["../../../../../../src/providers/s3/apis/server/getProperties.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getProperties = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst getProperties_1 = require(\"../internal/getProperties\");\nconst getProperties = (contextSpec, input) => (0, getProperties_1.getProperties)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.getProperties = getProperties;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAC7D,MAAM,aAAa,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,eAAe,CAAC,aAAa,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC1J,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getUrl = void 0;
7
7
  const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
8
8
  const getUrl_1 = require("../internal/getUrl");
9
- const getUrl = async (contextSpec, input) => {
10
- return (0, getUrl_1.getUrl)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
11
- };
9
+ const getUrl = async (contextSpec, input) => (0, getUrl_1.getUrl)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
12
10
  exports.getUrl = getUrl;
13
11
  //# sourceMappingURL=getUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/server/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst getUrl_1 = require(\"../internal/getUrl\");\nconst getUrl = async (contextSpec, input) => {\n return (0, getUrl_1.getUrl)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\n};\nexports.getUrl = getUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,MAAM,GAAG,OAAO,WAAW,EAAE,KAAK,KAAK;AAC7C,IAAI,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACzG,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/server/getUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUrl = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst getUrl_1 = require(\"../internal/getUrl\");\nconst getUrl = async (contextSpec, input) => (0, getUrl_1.getUrl)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.getUrl = getUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,MAAM,GAAG,OAAO,WAAW,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC3I,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.remove = void 0;
7
7
  const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
8
8
  const remove_1 = require("../internal/remove");
9
- const remove = (contextSpec, input) => {
10
- return (0, remove_1.remove)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
11
- };
9
+ const remove = (contextSpec, input) => (0, remove_1.remove)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);
12
10
  exports.remove = remove;
13
11
  //# sourceMappingURL=remove.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove.js","sources":["../../../../../../src/providers/s3/apis/server/remove.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.remove = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst remove_1 = require(\"../internal/remove\");\nconst remove = (contextSpec, input) => {\n return (0, remove_1.remove)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\n};\nexports.remove = remove;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,MAAM,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK;AACvC,IAAI,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACzG,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"remove.js","sources":["../../../../../../src/providers/s3/apis/server/remove.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.remove = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst remove_1 = require(\"../internal/remove\");\nconst remove = (contextSpec, input) => (0, remove_1.remove)((0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify, input);\nexports.remove = remove;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC3E,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC/C,MAAM,MAAM,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACrI,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UPLOADS_STORAGE_KEY = exports.DEFAULT_QUEUE_SIZE = exports.MAX_PARTS_COUNT = exports.MAX_OBJECT_SIZE = exports.DEFAULT_PART_SIZE = exports.MAX_URL_EXPIRATION = exports.DEFAULT_PRESIGN_EXPIRATION = exports.DEFAULT_ACCESS_LEVEL = exports.LOCAL_TESTING_S3_ENDPOINT = void 0;
6
+ exports.STORAGE_INPUT_PATH = exports.STORAGE_INPUT_KEY = exports.UPLOADS_STORAGE_KEY = exports.DEFAULT_QUEUE_SIZE = exports.MAX_PARTS_COUNT = exports.MAX_OBJECT_SIZE = exports.DEFAULT_PART_SIZE = exports.MAX_URL_EXPIRATION = exports.DEFAULT_PRESIGN_EXPIRATION = exports.DEFAULT_ACCESS_LEVEL = exports.LOCAL_TESTING_S3_ENDPOINT = void 0;
7
7
  exports.LOCAL_TESTING_S3_ENDPOINT = 'http://localhost:20005';
8
8
  exports.DEFAULT_ACCESS_LEVEL = 'guest';
9
9
  exports.DEFAULT_PRESIGN_EXPIRATION = 900;
@@ -16,4 +16,6 @@ exports.MAX_OBJECT_SIZE = 5 * TiB;
16
16
  exports.MAX_PARTS_COUNT = 10000;
17
17
  exports.DEFAULT_QUEUE_SIZE = 4;
18
18
  exports.UPLOADS_STORAGE_KEY = '__uploadInProgress';
19
+ exports.STORAGE_INPUT_KEY = 'key';
20
+ exports.STORAGE_INPUT_PATH = 'path';
19
21
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../src/providers/s3/utils/constants.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UPLOADS_STORAGE_KEY = exports.DEFAULT_QUEUE_SIZE = exports.MAX_PARTS_COUNT = exports.MAX_OBJECT_SIZE = exports.DEFAULT_PART_SIZE = exports.MAX_URL_EXPIRATION = exports.DEFAULT_PRESIGN_EXPIRATION = exports.DEFAULT_ACCESS_LEVEL = exports.LOCAL_TESTING_S3_ENDPOINT = void 0;\nexports.LOCAL_TESTING_S3_ENDPOINT = 'http://localhost:20005';\nexports.DEFAULT_ACCESS_LEVEL = 'guest';\nexports.DEFAULT_PRESIGN_EXPIRATION = 900;\nexports.MAX_URL_EXPIRATION = 7 * 24 * 60 * 60 * 1000;\nconst MiB = 1024 * 1024;\nconst GiB = 1024 * MiB;\nconst TiB = 1024 * GiB;\nexports.DEFAULT_PART_SIZE = 5 * MiB;\nexports.MAX_OBJECT_SIZE = 5 * TiB;\nexports.MAX_PARTS_COUNT = 10000;\nexports.DEFAULT_QUEUE_SIZE = 4;\nexports.UPLOADS_STORAGE_KEY = '__uploadInProgress';\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AACvR,OAAO,CAAC,yBAAyB,GAAG,wBAAwB,CAAC;AAC7D,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC;AACvC,OAAO,CAAC,0BAA0B,GAAG,GAAG,CAAC;AACzC,OAAO,CAAC,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACrD,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACxB,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AACvB,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AACvB,OAAO,CAAC,iBAAiB,GAAG,CAAC,GAAG,GAAG,CAAC;AACpC,OAAO,CAAC,eAAe,GAAG,CAAC,GAAG,GAAG,CAAC;AAClC,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC;AAChC,OAAO,CAAC,kBAAkB,GAAG,CAAC,CAAC;AAC/B,OAAO,CAAC,mBAAmB,GAAG,oBAAoB;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../src/providers/s3/utils/constants.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.STORAGE_INPUT_PATH = exports.STORAGE_INPUT_KEY = exports.UPLOADS_STORAGE_KEY = exports.DEFAULT_QUEUE_SIZE = exports.MAX_PARTS_COUNT = exports.MAX_OBJECT_SIZE = exports.DEFAULT_PART_SIZE = exports.MAX_URL_EXPIRATION = exports.DEFAULT_PRESIGN_EXPIRATION = exports.DEFAULT_ACCESS_LEVEL = exports.LOCAL_TESTING_S3_ENDPOINT = void 0;\nexports.LOCAL_TESTING_S3_ENDPOINT = 'http://localhost:20005';\nexports.DEFAULT_ACCESS_LEVEL = 'guest';\nexports.DEFAULT_PRESIGN_EXPIRATION = 900;\nexports.MAX_URL_EXPIRATION = 7 * 24 * 60 * 60 * 1000;\nconst MiB = 1024 * 1024;\nconst GiB = 1024 * MiB;\nconst TiB = 1024 * GiB;\nexports.DEFAULT_PART_SIZE = 5 * MiB;\nexports.MAX_OBJECT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,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAClC,OAAO,CAAC,kBAAkB,GAAG,MAAM;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createUploadTask = exports.createDownloadTask = exports.resolveS3ConfigAndInput = exports.calculateContentMd5 = void 0;
6
+ exports.isInputWithPath = exports.validateStorageOperationInput = exports.createUploadTask = exports.createDownloadTask = exports.resolveS3ConfigAndInput = exports.calculateContentMd5 = void 0;
7
7
  var md5_1 = require("./md5");
8
8
  Object.defineProperty(exports, "calculateContentMd5", { enumerable: true, get: function () { return md5_1.calculateContentMd5; } });
9
9
  var resolveS3ConfigAndInput_1 = require("./resolveS3ConfigAndInput");
@@ -11,4 +11,8 @@ Object.defineProperty(exports, "resolveS3ConfigAndInput", { enumerable: true, ge
11
11
  var transferTask_1 = require("./transferTask");
12
12
  Object.defineProperty(exports, "createDownloadTask", { enumerable: true, get: function () { return transferTask_1.createDownloadTask; } });
13
13
  Object.defineProperty(exports, "createUploadTask", { enumerable: true, get: function () { return transferTask_1.createUploadTask; } });
14
+ var validateStorageOperationInput_1 = require("./validateStorageOperationInput");
15
+ Object.defineProperty(exports, "validateStorageOperationInput", { enumerable: true, get: function () { return validateStorageOperationInput_1.validateStorageOperationInput; } });
16
+ var isInputWithPath_1 = require("./isInputWithPath");
17
+ Object.defineProperty(exports, "isInputWithPath", { enumerable: true, get: function () { return isInputWithPath_1.isInputWithPath; } });
14
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/providers/s3/utils/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createUploadTask = exports.createDownloadTask = exports.resolveS3ConfigAndInput = exports.calculateContentMd5 = void 0;\nvar md5_1 = require(\"./md5\");\nObject.defineProperty(exports, \"calculateContentMd5\", { enumerable: true, get: function () { return md5_1.calculateContentMd5; } });\nvar resolveS3ConfigAndInput_1 = require(\"./resolveS3ConfigAndInput\");\nObject.defineProperty(exports, \"resolveS3ConfigAndInput\", { enumerable: true, get: function () { return resolveS3ConfigAndInput_1.resolveS3ConfigAndInput; } });\nvar transferTask_1 = require(\"./transferTask\");\nObject.defineProperty(exports, \"createDownloadTask\", { enumerable: true, get: function () { return transferTask_1.createDownloadTask; } });\nObject.defineProperty(exports, \"createUploadTask\", { enumerable: true, get: function () { return transferTask_1.createUploadTask; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,CAAC;AAC/H,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,qBAAqB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,KAAK,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC;AACpI,IAAI,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACrE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,yBAAyB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,yBAAyB,CAAC,uBAAuB,CAAC,EAAE,EAAE,CAAC,CAAC;AAChK,IAAI,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC/C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3I,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/providers/s3/utils/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isInputWithPath = exports.validateStorageOperationInput = exports.createUploadTask = exports.createDownloadTask = exports.resolveS3ConfigAndInput = exports.calculateContentMd5 = void 0;\nvar md5_1 = require(\"./md5\");\nObject.defineProperty(exports, \"calculateContentMd5\", { enumerable: true, get: function () { return md5_1.calculateContentMd5; } });\nvar resolveS3ConfigAndInput_1 = require(\"./resolveS3ConfigAndInput\");\nObject.defineProperty(exports, \"resolveS3ConfigAndInput\", { enumerable: true, get: function () { return resolveS3ConfigAndInput_1.resolveS3ConfigAndInput; } });\nvar transferTask_1 = require(\"./transferTask\");\nObject.defineProperty(exports, \"createDownloadTask\", { enumerable: true, get: function () { return transferTask_1.createDownloadTask; } });\nObject.defineProperty(exports, \"createUploadTask\", { enumerable: true, get: function () { return transferTask_1.createUploadTask; } });\nvar validateStorageOperationInput_1 = require(\"./validateStorageOperationInput\");\nObject.defineProperty(exports, \"validateStorageOperationInput\", { enumerable: true, get: function () { return validateStorageOperationInput_1.validateStorageOperationInput; } });\nvar isInputWithPath_1 = require(\"./isInputWithPath\");\nObject.defineProperty(exports, \"isInputWithPath\", { enumerable: true, get: function () { return isInputWithPath_1.isInputWithPath; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CA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AU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,+BAA+B,CAAC,6BAA6B,CAAC,EAAE,EAAE,CAAC,CAAC;AAClL,IAAI,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,iBAAiB,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;;"}
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isInputWithPath = void 0;
7
+ const isInputWithPath = (input) => {
8
+ return input.path !== undefined;
9
+ };
10
+ exports.isInputWithPath = isInputWithPath;
11
+ //# sourceMappingURL=isInputWithPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isInputWithPath.js","sources":["../../../../../src/providers/s3/utils/isInputWithPath.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isInputWithPath = void 0;\nconst isInputWithPath = (input) => {\n return input.path !== undefined;\n};\nexports.isInputWithPath = isInputWithPath;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AACjC,MAAM,eAAe,GAAG,CAAC,KAAK,KAAK;AACnC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;AACpC,CAAC,CAAC;AACF,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
@@ -14,7 +14,7 @@ const constants_1 = require("./constants");
14
14
  * @param {AmplifyClassV6} amplify The Amplify instance.
15
15
  * @param {S3ApiOptions} apiOptions The input options for S3 provider.
16
16
  * @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.
17
- * @throws A {@link StorageError} with `error.name` from {@link StorageValidationErrorCode} indicating invalid
17
+ * @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid
18
18
  * configurations or Amplify library options.
19
19
  *
20
20
  * @internal
@@ -51,6 +51,7 @@ const resolveS3ConfigAndInput = async (amplify, apiOptions) => {
51
51
  },
52
52
  bucket,
53
53
  keyPrefix,
54
+ identityId,
54
55
  isObjectLockEnabled,
55
56
  };
56
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"resolveS3ConfigAndInput.js","sources":["../../../../../src/providers/s3/utils/resolveS3ConfigAndInput.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveS3ConfigAndInput = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst resolvePrefix_1 = require(\"../../../utils/resolvePrefix\");\nconst constants_1 = require(\"./constants\");\n/**\n * resolve the common input options for S3 API handlers from Amplify configuration and library options.\n *\n * @param {AmplifyClassV6} amplify The Amplify instance.\n * @param {S3ApiOptions} apiOptions The input options for S3 provider.\n * @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.\n * @throws A {@link StorageError} with `error.name` from {@link StorageValidationErrorCode} indicating invalid\n * configurations or Amplify library options.\n *\n * @internal\n */\nconst resolveS3ConfigAndInput = async (amplify, apiOptions) => {\n // identityId is always cached in memory if forceRefresh is not set. So we can safely make calls here.\n const { credentials, identityId } = await amplify.Auth.fetchAuthSession({\n forceRefresh: false,\n });\n (0, assertValidationError_1.assertValidationError)(!!credentials, validation_1.StorageValidationErrorCode.NoCredentials);\n (0, assertValidationError_1.assertValidationError)(!!identityId, validation_1.StorageValidationErrorCode.NoIdentityId);\n const { bucket, region, dangerouslyConnectToHttpEndpointForTesting } = amplify.getConfig()?.Storage?.S3 ?? {};\n (0, assertValidationError_1.assertValidationError)(!!bucket, validation_1.StorageValidationErrorCode.NoBucket);\n (0, assertValidationError_1.assertValidationError)(!!region, validation_1.StorageValidationErrorCode.NoRegion);\n const { defaultAccessLevel, prefixResolver = resolvePrefix_1.resolvePrefix, isObjectLockEnabled, } = amplify.libraryOptions?.Storage?.S3 ?? {};\n const keyPrefix = await prefixResolver({\n accessLevel: apiOptions?.accessLevel ?? defaultAccessLevel ?? constants_1.DEFAULT_ACCESS_LEVEL,\n // use conditional assign to make tsc happy because StorageOptions is a union type that may not have targetIdentityId\n targetIdentityId: apiOptions?.accessLevel === 'protected'\n ? apiOptions?.targetIdentityId ?? identityId\n : identityId,\n });\n return {\n s3Config: {\n credentials,\n region,\n useAccelerateEndpoint: apiOptions?.useAccelerateEndpoint,\n ...(dangerouslyConnectToHttpEndpointForTesting\n ? {\n customEndpoint: constants_1.LOCAL_TESTING_S3_ENDPOINT,\n forcePathStyle: true,\n }\n : {}),\n },\n bucket,\n keyPrefix,\n isObjectLockEnabled,\n };\n};\nexports.resolveS3ConfigAndInput = resolveS3ConfigAndInput;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACzC,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC,CAAC;AACvF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACjE,MAAM,eAAe,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAChE,MAAM,WAAW,GAAG,OAA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E,WAAW,KAAK,WAAW;AACjE,cAAc,UAAU,EAAE,gBAAgB,IAAI,UAAU;AACxD,cAAc,UAAU;AACxB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE;AAClB,YAAY,WAAW;AACvB,YAAY,MAAM;AAClB,YAAY,qBAAqB,EAAE,UAAU,EAAE,qBAAqB;AACpE,YAAY,IAAI,0CAA0C;AAC1D,kBAAkB;AAClB,oBAAoB,cAAc,EAAE,WAAW,CAAC,yBAAyB;AACzE,oBAAoB,cAAc,EAAE,IAAI;AACxC,iBAAiB;AACjB,kBAAkB,EAAE;AACpB,SAAS;AACT,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,QAAQ,mBAAmB;AAC3B,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,uBAAuB,GAAG,uBAAuB;;"}
1
+ {"version":3,"file":"resolveS3ConfigAndInput.js","sources":["../../../../../src/providers/s3/utils/resolveS3ConfigAndInput.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveS3ConfigAndInput = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst resolvePrefix_1 = require(\"../../../utils/resolvePrefix\");\nconst constants_1 = require(\"./constants\");\n/**\n * resolve the common input options for S3 API handlers from Amplify configuration and library options.\n *\n * @param {AmplifyClassV6} amplify The Amplify instance.\n * @param {S3ApiOptions} apiOptions The input options for S3 provider.\n * @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.\n * @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid\n * configurations or Amplify library options.\n *\n * @internal\n */\nconst resolveS3ConfigAndInput = async (amplify, apiOptions) => {\n // identityId is always cached in memory if forceRefresh is not set. So we can safely make calls here.\n const { credentials, identityId } = await amplify.Auth.fetchAuthSession({\n forceRefresh: false,\n });\n (0, assertValidationError_1.assertValidationError)(!!credentials, validation_1.StorageValidationErrorCode.NoCredentials);\n (0, assertValidationError_1.assertValidationError)(!!identityId, validation_1.StorageValidationErrorCode.NoIdentityId);\n const { bucket, region, dangerouslyConnectToHttpEndpointForTesting } = amplify.getConfig()?.Storage?.S3 ?? {};\n (0, assertValidationError_1.assertValidationError)(!!bucket, validation_1.StorageValidationErrorCode.NoBucket);\n (0, assertValidationError_1.assertValidationError)(!!region, validation_1.StorageValidationErrorCode.NoRegion);\n const { defaultAccessLevel, prefixResolver = resolvePrefix_1.resolvePrefix, isObjectLockEnabled, } = amplify.libraryOptions?.Storage?.S3 ?? {};\n const keyPrefix = await prefixResolver({\n accessLevel: apiOptions?.accessLevel ?? defaultAccessLevel ?? constants_1.DEFAULT_ACCESS_LEVEL,\n // use conditional assign to make tsc happy because StorageOptions is a union type that may not have targetIdentityId\n targetIdentityId: apiOptions?.accessLevel === 'protected'\n ? apiOptions?.targetIdentityId ?? identityId\n : identityId,\n });\n return {\n s3Config: {\n credentials,\n region,\n useAccelerateEndpoint: apiOptions?.useAccelerateEndpoint,\n ...(dangerouslyConnectToHttpEndpointForTesting\n ? {\n customEndpoint: constants_1.LOCAL_TESTING_S3_ENDPOINT,\n forcePathStyle: true,\n }\n : {}),\n },\n bucket,\n keyPrefix,\n identityId,\n isObjectLockEnabled,\n };\n};\nexports.resolveS3ConfigAndInput = resolveS3ConfigAndInput;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACzC,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC,CAAC;AACvF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACjE,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,kBAAkB,IAAI,WAAW,CAAC,oBAAoB;AACtG;AACA,QAAQ,gBAAgB,EAAE,UAAU,EAAE,WAAW,KAAK,WAAW;AACjE,cAAc,UAAU,EAAE,gBAAgB,IAAI,UAAU;AACxD,cAAc,UAAU;AACxB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE;AAClB,YAAY,WAAW;AACvB,YAAY,MAAM;AAClB,YAAY,qBAAqB,EAAE,UAAU,EAAE,qBAAqB;AACpE,YAAY,IAAI,0CAA0C;AAC1D,kBAAkB;AAClB,oBAAoB,cAAc,EAAE,WAAW,CAAC,yBAAyB;AACzE,oBAAoB,cAAc,EAAE,IAAI;AACxC,iBAAiB;AACjB,kBAAkB,EAAE;AACpB,SAAS;AACT,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,QAAQ,UAAU;AAClB,QAAQ,mBAAmB;AAC3B,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,uBAAuB,GAAG,uBAAuB;;"}
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validateStorageOperationInput = void 0;
7
+ const assertValidationError_1 = require("../../../errors/utils/assertValidationError");
8
+ const validation_1 = require("../../../errors/types/validation");
9
+ const isInputWithPath_1 = require("./isInputWithPath");
10
+ const constants_1 = require("./constants");
11
+ const validateStorageOperationInput = (input, identityId) => {
12
+ (0, assertValidationError_1.assertValidationError)(
13
+ // Key present without a path
14
+ (!!input.key && !input.path) ||
15
+ // Path present without a key
16
+ (!input.key && !!input.path), validation_1.StorageValidationErrorCode.InvalidStorageOperationInput);
17
+ if ((0, isInputWithPath_1.isInputWithPath)(input)) {
18
+ const { path } = input;
19
+ const objectKey = typeof path === 'string' ? path : path({ identityId });
20
+ (0, assertValidationError_1.assertValidationError)(!objectKey.startsWith('/'), validation_1.StorageValidationErrorCode.InvalidStoragePathInput);
21
+ return {
22
+ inputType: constants_1.STORAGE_INPUT_PATH,
23
+ objectKey,
24
+ };
25
+ }
26
+ else {
27
+ return { inputType: constants_1.STORAGE_INPUT_KEY, objectKey: input.key };
28
+ }
29
+ };
30
+ exports.validateStorageOperationInput = validateStorageOperationInput;
31
+ //# sourceMappingURL=validateStorageOperationInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateStorageOperationInput.js","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInput.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateStorageOperationInput = void 0;\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst isInputWithPath_1 = require(\"./isInputWithPath\");\nconst constants_1 = require(\"./constants\");\nconst validateStorageOperationInput = (input, identityId) => {\n (0, assertValidationError_1.assertValidationError)(\n // Key present without a path\n (!!input.key && !input.path) ||\n // Path present without a key\n (!input.key && !!input.path), validation_1.StorageValidationErrorCode.InvalidStorageOperationInput);\n if ((0, isInputWithPath_1.isInputWithPath)(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string' ? path : path({ identityId });\n (0, assertValidationError_1.assertValidationError)(!objectKey.startsWith('/'), validation_1.StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: constants_1.STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: constants_1.STORAGE_INPUT_KEY, objectKey: input.key };\n }\n};\nexports.validateStorageOperationInput = validateStorageOperationInput;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6BAA6B,GAAG,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B,GAAG,6BAA6B;;"}
@@ -5,10 +5,14 @@ export declare enum StorageValidationErrorCode {
5
5
  NoKey = "NoKey",
6
6
  NoSourceKey = "NoSourceKey",
7
7
  NoDestinationKey = "NoDestinationKey",
8
+ NoSourcePath = "NoSourcePath",
9
+ NoDestinationPath = "NoDestinationPath",
8
10
  NoBucket = "NoBucket",
9
11
  NoRegion = "NoRegion",
10
- UrlExpirationMaxLimitExceed = "UrlExpirationMaxLimitExceed",
12
+ InvalidStorageOperationInput = "InvalidStorageOperationInput",
13
+ InvalidStoragePathInput = "InvalidStoragePathInput",
14
+ InvalidUploadSource = "InvalidUploadSource",
11
15
  ObjectIsTooLarge = "ObjectIsTooLarge",
12
- InvalidUploadSource = "InvalidUploadSource"
16
+ UrlExpirationMaxLimitExceed = "UrlExpirationMaxLimitExceed"
13
17
  }
14
18
  export declare const validationErrorMap: AmplifyErrorMap<StorageValidationErrorCode>;
@@ -7,11 +7,15 @@ var StorageValidationErrorCode;
7
7
  StorageValidationErrorCode["NoKey"] = "NoKey";
8
8
  StorageValidationErrorCode["NoSourceKey"] = "NoSourceKey";
9
9
  StorageValidationErrorCode["NoDestinationKey"] = "NoDestinationKey";
10
+ StorageValidationErrorCode["NoSourcePath"] = "NoSourcePath";
11
+ StorageValidationErrorCode["NoDestinationPath"] = "NoDestinationPath";
10
12
  StorageValidationErrorCode["NoBucket"] = "NoBucket";
11
13
  StorageValidationErrorCode["NoRegion"] = "NoRegion";
12
- StorageValidationErrorCode["UrlExpirationMaxLimitExceed"] = "UrlExpirationMaxLimitExceed";
13
- StorageValidationErrorCode["ObjectIsTooLarge"] = "ObjectIsTooLarge";
14
+ StorageValidationErrorCode["InvalidStorageOperationInput"] = "InvalidStorageOperationInput";
15
+ StorageValidationErrorCode["InvalidStoragePathInput"] = "InvalidStoragePathInput";
14
16
  StorageValidationErrorCode["InvalidUploadSource"] = "InvalidUploadSource";
17
+ StorageValidationErrorCode["ObjectIsTooLarge"] = "ObjectIsTooLarge";
18
+ StorageValidationErrorCode["UrlExpirationMaxLimitExceed"] = "UrlExpirationMaxLimitExceed";
15
19
  })(StorageValidationErrorCode || (StorageValidationErrorCode = {}));
16
20
  const validationErrorMap = {
17
21
  [StorageValidationErrorCode.NoCredentials]: {
@@ -29,6 +33,12 @@ const validationErrorMap = {
29
33
  [StorageValidationErrorCode.NoDestinationKey]: {
30
34
  message: 'Missing destination key in copy api call.',
31
35
  },
36
+ [StorageValidationErrorCode.NoSourcePath]: {
37
+ message: 'Missing source path in copy api call.',
38
+ },
39
+ [StorageValidationErrorCode.NoDestinationPath]: {
40
+ message: 'Missing destination path in copy api call.',
41
+ },
32
42
  [StorageValidationErrorCode.NoBucket]: {
33
43
  message: 'Missing bucket name while accessing object.',
34
44
  },
@@ -44,6 +54,12 @@ const validationErrorMap = {
44
54
  [StorageValidationErrorCode.InvalidUploadSource]: {
45
55
  message: 'Upload source type can only be a `Blob`, `File`, `ArrayBuffer`, or `string`.',
46
56
  },
57
+ [StorageValidationErrorCode.InvalidStorageOperationInput]: {
58
+ message: 'Path or key parameter must be specified in the input. Both can not be specified at the same time.',
59
+ },
60
+ [StorageValidationErrorCode.InvalidStoragePathInput]: {
61
+ message: 'Input `path` does not allow a leading slash (/).',
62
+ },
47
63
  };
48
64
 
49
65
  export { StorageValidationErrorCode, validationErrorMap };
@@ -1 +1 @@
1
- {"version":3,"file":"validation.mjs","sources":["../../../../src/errors/types/validation.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport var StorageValidationErrorCode;\n(function (StorageValidationErrorCode) {\n StorageValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n StorageValidationErrorCode[\"NoIdentityId\"] = \"NoIdentityId\";\n StorageValidationErrorCode[\"NoKey\"] = \"NoKey\";\n StorageValidationErrorCode[\"NoSourceKey\"] = \"NoSourceKey\";\n StorageValidationErrorCode[\"NoDestinationKey\"] = \"NoDestinationKey\";\n StorageValidationErrorCode[\"NoBucket\"] = \"NoBucket\";\n StorageValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n StorageValidationErrorCode[\"UrlExpirationMaxLimitExceed\"] = \"UrlExpirationMaxLimitExceed\";\n StorageValidationErrorCode[\"ObjectIsTooLarge\"] = \"ObjectIsTooLarge\";\n StorageValidationErrorCode[\"InvalidUploadSource\"] = \"InvalidUploadSource\";\n})(StorageValidationErrorCode || (StorageValidationErrorCode = {}));\nexport const validationErrorMap = {\n [StorageValidationErrorCode.NoCredentials]: {\n message: 'Credentials should not be empty.',\n },\n [StorageValidationErrorCode.NoIdentityId]: {\n message: 'Missing identity ID when accessing objects in protected or private access level.',\n },\n [StorageValidationErrorCode.NoKey]: {\n message: 'Missing key in api call.',\n },\n [StorageValidationErrorCode.NoSourceKey]: {\n message: 'Missing source key in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationKey]: {\n message: 'Missing destination key in copy api call.',\n },\n [StorageValidationErrorCode.NoBucket]: {\n message: 'Missing bucket name while accessing object.',\n },\n [StorageValidationErrorCode.NoRegion]: {\n message: 'Missing region while accessing object.',\n },\n [StorageValidationErrorCode.UrlExpirationMaxLimitExceed]: {\n message: 'Url Expiration can not be greater than 7 Days.',\n },\n [StorageValidationErrorCode.ObjectIsTooLarge]: {\n message: 'Object size cannot not be greater than 5TB.',\n },\n [StorageValidationErrorCode.InvalidUploadSource]: {\n message: 'Upload source type can only be a `Blob`, `File`, `ArrayBuffer`, or `string`.',\n },\n};\n"],"names":[],"mappings":"AAAA;AACA;AACU,IAAC,2BAA2B;AACtC,CAAC,UAAU,0BAA0B,EAAE;AACvC,IAAI,0BAA0B,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAClE,IAAI,0BAA0B,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AAChE,IAAI,0BAA0B,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAClD,IAAI,0BAA0B,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;AAC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AACnD,QAAQ,OAAO,EAAE,6CAA6C;AAC9D,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,mBAAmB,GAAG;AACtD,QAAQ,OAAO,EAAE,8EAA8E;AAC/F,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"validation.mjs","sources":["../../../../src/errors/types/validation.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport var StorageValidationErrorCode;\n(function (StorageValidationErrorCode) {\n StorageValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n StorageValidationErrorCode[\"NoIdentityId\"] = \"NoIdentityId\";\n StorageValidationErrorCode[\"NoKey\"] = \"NoKey\";\n StorageValidationErrorCode[\"NoSourceKey\"] = \"NoSourceKey\";\n StorageValidationErrorCode[\"NoDestinationKey\"] = \"NoDestinationKey\";\n StorageValidationErrorCode[\"NoSourcePath\"] = \"NoSourcePath\";\n StorageValidationErrorCode[\"NoDestinationPath\"] = \"NoDestinationPath\";\n StorageValidationErrorCode[\"NoBucket\"] = \"NoBucket\";\n StorageValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n StorageValidationErrorCode[\"InvalidStorageOperationInput\"] = \"InvalidStorageOperationInput\";\n StorageValidationErrorCode[\"InvalidStoragePathInput\"] = \"InvalidStoragePathInput\";\n StorageValidationErrorCode[\"InvalidUploadSource\"] = \"InvalidUploadSource\";\n StorageValidationErrorCode[\"ObjectIsTooLarge\"] = \"ObjectIsTooLarge\";\n StorageValidationErrorCode[\"UrlExpirationMaxLimitExceed\"] = \"UrlExpirationMaxLimitExceed\";\n})(StorageValidationErrorCode || (StorageValidationErrorCode = {}));\nexport const validationErrorMap = {\n [StorageValidationErrorCode.NoCredentials]: {\n message: 'Credentials should not be empty.',\n },\n [StorageValidationErrorCode.NoIdentityId]: {\n message: 'Missing identity ID when accessing objects in protected or private access level.',\n },\n [StorageValidationErrorCode.NoKey]: {\n message: 'Missing key in api call.',\n },\n [StorageValidationErrorCode.NoSourceKey]: {\n message: 'Missing source key in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationKey]: {\n message: 'Missing destination key in copy api call.',\n },\n [StorageValidationErrorCode.NoSourcePath]: {\n message: 'Missing source path in copy api call.',\n },\n [StorageValidationErrorCode.NoDestinationPath]: {\n message: 'Missing destination path in copy api call.',\n },\n [StorageValidationErrorCode.NoBucket]: {\n message: 'Missing bucket name while accessing object.',\n },\n [StorageValidationErrorCode.NoRegion]: {\n message: 'Missing region while accessing object.',\n },\n [StorageValidationErrorCode.UrlExpirationMaxLimitExceed]: {\n message: 'Url Expiration can not be greater than 7 Days.',\n },\n [StorageValidationErrorCode.ObjectIsTooLarge]: {\n message: 'Object size cannot not be greater than 5TB.',\n },\n [StorageValidationErrorCode.InvalidUploadSource]: {\n message: 'Upload source type can only be a `Blob`, `File`, `ArrayBuffer`, or `string`.',\n },\n [StorageValidationErrorCode.InvalidStorageOperationInput]: {\n message: 'Path or key parameter must be specified in the input. Both can not be specified at the same time.',\n },\n [StorageValidationErrorCode.InvalidStoragePathInput]: {\n message: 'Input `path` does not allow a leading slash (/).',\n },\n};\n"],"names":[],"mappings":"AAAA;AACA;AACU,IAAC,2BAA2B;AACtC,CAAC,UAAU,0BAA0B,EAAE;AACvC,IAAI,0BAA0B,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAClE,IAAI,0BAA0B,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AAChE,IAAI,0BAA0B,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAClD,IAAI,0BAA0B,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;AAC9D,IAAI,0BAA0B,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AACxE,IAAI,0BAA0B,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AAChE,IAAI,0BAA0B,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAC1E,IAAI,0BAA0B,CAAC,UAAU,CA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BAA0B,CAAC,QAAQ,GAAG;AAC3C,QAAQ,OAAO,EAAE,wCAAwC;AACzD,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,2BAA2B,GAAG;AAC9D,QAAQ,OAAO,EAAE,gDAAgD;AACjE,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,gBAAgB,GAAG;AACnD,QAAQ,OAAO,EAAE,6CAA6C;AAC9D,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,mBAAmB,GAAG;AACtD,QAAQ,OAAO,EAAE,8EAA8E;AAC/F,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,4BAA4B,GAAG;AAC/D,QAAQ,OAAO,EAAE,mGAAmG;AACpH,KAAK;AACL,IAAI,CAAC,0BAA0B,CAAC,uBAAuB,GAAG;AAC1D,QAAQ,OAAO,EAAE,kDAAkD;AACnE,KAAK;AACL;;;;"}
@@ -1,12 +1,29 @@
1
- import { CopyInput, CopyOutput } from '../types';
2
- /**
3
- * Copy an object from a source object to a new object within the same bucket. Can optionally copy files across
4
- * different level or identityId (if source object's level is 'protected').
5
- *
6
- * @param input - The CopyInput object.
7
- * @returns Output containing the destination key.
8
- * @throws service: {@link S3Exception} - Thrown when checking for existence of the object
9
- * @throws validation: {@link StorageValidationErrorCode } - Thrown when
10
- * source or destination key are not defined.
11
- */
12
- export declare const copy: (input: CopyInput) => Promise<CopyOutput>;
1
+ import { CopyInputKey, CopyInputPath, CopyOutputKey, CopyOutputPath } from '../types';
2
+ interface Copy {
3
+ /**
4
+ * Copy an object from a source to a destination object within the same bucket.
5
+ *
6
+ * @param input - The CopyInputPath object.
7
+ * @returns Output containing the destination object path.
8
+ * @throws service: `S3Exception` - Thrown when checking for existence of the object
9
+ * @throws validation: `StorageValidationErrorCode` - Thrown when
10
+ * source or destination path is not defined.
11
+ */
12
+ (input: CopyInputPath): Promise<CopyOutputPath>;
13
+ /**
14
+ * @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
15
+ * Please use {@link https://docs.amplify.aws/react/build-a-backend/storage/copy | path} instead.
16
+ *
17
+ * Copy an object from a source to a destination object within the same bucket. Can optionally copy files across
18
+ * different accessLevel or identityId (if source object's accessLevel is 'protected').
19
+ *
20
+ * @param input - The CopyInputKey object.
21
+ * @returns Output containing the destination object key.
22
+ * @throws service: `S3Exception` - Thrown when checking for existence of the object
23
+ * @throws validation: `StorageValidationErrorCode` - Thrown when
24
+ * source or destination key is not defined.
25
+ */
26
+ (input: CopyInputKey): Promise<CopyOutputKey>;
27
+ }
28
+ export declare const copy: Copy;
29
+ export {};
@@ -3,19 +3,7 @@ import { copy as copy$1 } from './internal/copy.mjs';
3
3
 
4
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
5
  // SPDX-License-Identifier: Apache-2.0
6
- /**
7
- * Copy an object from a source object to a new object within the same bucket. Can optionally copy files across
8
- * different level or identityId (if source object's level is 'protected').
9
- *
10
- * @param input - The CopyInput object.
11
- * @returns Output containing the destination key.
12
- * @throws service: {@link S3Exception} - Thrown when checking for existence of the object
13
- * @throws validation: {@link StorageValidationErrorCode } - Thrown when
14
- * source or destination key are not defined.
15
- */
16
- const copy = async (input) => {
17
- return copy$1(Amplify, input);
18
- };
6
+ const copy = (input) => copy$1(Amplify, input);
19
7
 
20
8
  export { copy };
21
9
  //# sourceMappingURL=copy.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"copy.mjs","sources":["../../../../../src/providers/s3/apis/copy.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { copy as copyInternal } from './internal/copy';\n/**\n * Copy an object from a source object to a new object within the same bucket. Can optionally copy files across\n * different level or identityId (if source object's level is 'protected').\n *\n * @param input - The CopyInput object.\n * @returns Output containing the destination key.\n * @throws service: {@link S3Exception} - Thrown when checking for existence of the object\n * @throws validation: {@link StorageValidationErrorCode } - Thrown when\n * source or destination key are not defined.\n */\nexport const copy = async (input) => {\n return copyInternal(Amplify, input);\n};\n"],"names":["copyInternal"],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,IAAI,GAAG,OAAO,KAAK,KAAK;AACrC,IAAI,OAAOA,MAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACxC;;;;"}
1
+ {"version":3,"file":"copy.mjs","sources":["../../../../../src/providers/s3/apis/copy.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { copy as copyInternal } from './internal/copy';\nexport const copy = (input) => copyInternal(Amplify, input);\n"],"names":["copyInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,IAAI,GAAG,CAAC,KAAK,KAAKA,MAAY,CAAC,OAAO,EAAE,KAAK;;;;"}
@@ -1,32 +1,70 @@
1
- import { DownloadDataInput, DownloadDataOutput } from '../types';
2
- /**
3
- * Download S3 object data to memory
4
- *
5
- * @param input - The DownloadDataInput object.
6
- * @returns A cancelable task exposing result promise from `result` property.
7
- * @throws service: {@link S3Exception} - thrown when checking for existence of the object
8
- * @throws validation: {@link StorageValidationErrorCode } - Validation errors
9
- *
10
- * @example
11
- * ```ts
12
- * // Download a file from s3 bucket
13
- * const { body, eTag } = await downloadData({ key, data: file, options: {
14
- * onProgress, // Optional progress callback.
15
- * } }).result;
16
- * ```
17
- * @example
18
- * ```ts
19
- * // Cancel a task
20
- * const downloadTask = downloadData({ key, data: file });
21
- * //...
22
- * downloadTask.cancel();
23
- * try {
24
- * await downloadTask.result;
25
- * } catch (error) {
26
- * if(isCancelError(error)) {
27
- * // Handle error thrown by task cancelation.
28
- * }
29
- * }
30
- *```
31
- */
32
- export declare const downloadData: (input: DownloadDataInput) => DownloadDataOutput;
1
+ import { DownloadDataInputKey, DownloadDataInputPath, DownloadDataOutputKey, DownloadDataOutputPath } from '../types';
2
+ interface DownloadData {
3
+ /**
4
+ * Download S3 object data to memory
5
+ *
6
+ * @param input - The DownloadDataInputPath object.
7
+ * @returns A cancelable task exposing result promise from `result` property.
8
+ * @throws service: `S3Exception` - thrown when checking for existence of the object
9
+ * @throws validation: `StorageValidationErrorCode` - Validation errors
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * // Download a file from s3 bucket
14
+ * const { body, eTag } = await downloadData({ path, options: {
15
+ * onProgress, // Optional progress callback.
16
+ * } }).result;
17
+ * ```
18
+ * @example
19
+ * ```ts
20
+ * // Cancel a task
21
+ * const downloadTask = downloadData({ path });
22
+ * //...
23
+ * downloadTask.cancel();
24
+ * try {
25
+ * await downloadTask.result;
26
+ * } catch (error) {
27
+ * if(isCancelError(error)) {
28
+ * // Handle error thrown by task cancelation.
29
+ * }
30
+ * }
31
+ *```
32
+ */
33
+ (input: DownloadDataInputPath): DownloadDataOutputPath;
34
+ /**
35
+ * @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
36
+ * Please use {@link https://docs.amplify.aws/react/build-a-backend/storage/download/#downloaddata | path} instead.
37
+ *
38
+ * Download S3 object data to memory
39
+ *
40
+ * @param input - The DownloadDataInputKey object.
41
+ * @returns A cancelable task exposing result promise from `result` property.
42
+ * @throws service: `S3Exception` - thrown when checking for existence of the object
43
+ * @throws validation: `StorageValidationErrorCode` - Validation errors
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // Download a file from s3 bucket
48
+ * const { body, eTag } = await downloadData({ key, options: {
49
+ * onProgress, // Optional progress callback.
50
+ * } }).result;
51
+ * ```
52
+ * @example
53
+ * ```ts
54
+ * // Cancel a task
55
+ * const downloadTask = downloadData({ key });
56
+ * //...
57
+ * downloadTask.cancel();
58
+ * try {
59
+ * await downloadTask.result;
60
+ * } catch (error) {
61
+ * if(isCancelError(error)) {
62
+ * // Handle error thrown by task cancelation.
63
+ * }
64
+ * }
65
+ *```
66
+ */
67
+ (input: DownloadDataInputKey): DownloadDataOutputKey;
68
+ }
69
+ export declare const downloadData: DownloadData;
70
+ export {};
@@ -8,6 +8,7 @@ import 'fast-xml-parser';
8
8
  import '../utils/client/runtime/s3TransferHandler/xhr.mjs';
9
9
  import 'buffer';
10
10
  import { createDownloadTask } from '../utils/transferTask.mjs';
11
+ import { validateStorageOperationInput } from '../utils/validateStorageOperationInput.mjs';
11
12
  import '../utils/client/base.mjs';
12
13
  import { getObject } from '../utils/client/getObject.mjs';
13
14
  import '../utils/client/listObjectsV2.mjs';
@@ -23,39 +24,10 @@ import '../utils/client/deleteObject.mjs';
23
24
  import { getStorageUserAgentValue } from '../utils/userAgent.mjs';
24
25
  import '../../../errors/types/validation.mjs';
25
26
  import { logger } from '../../../utils/logger.mjs';
27
+ import { STORAGE_INPUT_KEY } from '../utils/constants.mjs';
26
28
 
27
29
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
28
30
  // SPDX-License-Identifier: Apache-2.0
29
- /**
30
- * Download S3 object data to memory
31
- *
32
- * @param input - The DownloadDataInput object.
33
- * @returns A cancelable task exposing result promise from `result` property.
34
- * @throws service: {@link S3Exception} - thrown when checking for existence of the object
35
- * @throws validation: {@link StorageValidationErrorCode } - Validation errors
36
- *
37
- * @example
38
- * ```ts
39
- * // Download a file from s3 bucket
40
- * const { body, eTag } = await downloadData({ key, data: file, options: {
41
- * onProgress, // Optional progress callback.
42
- * } }).result;
43
- * ```
44
- * @example
45
- * ```ts
46
- * // Cancel a task
47
- * const downloadTask = downloadData({ key, data: file });
48
- * //...
49
- * downloadTask.cancel();
50
- * try {
51
- * await downloadTask.result;
52
- * } catch (error) {
53
- * if(isCancelError(error)) {
54
- * // Handle error thrown by task cancelation.
55
- * }
56
- * }
57
- *```
58
- */
59
31
  const downloadData = (input) => {
60
32
  const abortController = new AbortController();
61
33
  const downloadTask = createDownloadTask({
@@ -66,10 +38,12 @@ const downloadData = (input) => {
66
38
  });
67
39
  return downloadTask;
68
40
  };
69
- const downloadDataJob = ({ options: downloadDataOptions, key }, abortSignal) => async () => {
70
- const { bucket, keyPrefix, s3Config } = await resolveS3ConfigAndInput(Amplify, downloadDataOptions);
71
- const finalKey = keyPrefix + key;
72
- logger.debug(`download ${key} from ${finalKey}.`);
41
+ const downloadDataJob = (downloadDataInput, abortSignal) => async () => {
42
+ const { options: downloadDataOptions } = downloadDataInput;
43
+ const { bucket, keyPrefix, s3Config, identityId } = await resolveS3ConfigAndInput(Amplify, downloadDataOptions);
44
+ const { inputType, objectKey } = validateStorageOperationInput(downloadDataInput, identityId);
45
+ const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
46
+ logger.debug(`download ${objectKey} from ${finalKey}.`);
73
47
  const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await getObject({
74
48
  ...s3Config,
75
49
  abortSignal,
@@ -82,8 +56,7 @@ const downloadDataJob = ({ options: downloadDataOptions, key }, abortSignal) =>
82
56
  Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,
83
57
  }),
84
58
  });
85
- return {
86
- key,
59
+ const result = {
87
60
  body,
88
61
  lastModified,
89
62
  size,
@@ -92,6 +65,9 @@ const downloadDataJob = ({ options: downloadDataOptions, key }, abortSignal) =>
92
65
  metadata,
93
66
  versionId,
94
67
  };
68
+ return inputType === STORAGE_INPUT_KEY
69
+ ? { key: objectKey, ...result }
70
+ : { path: finalKey, ...result };
95
71
  };
96
72
 
97
73
  export { downloadData };