@aws-amplify/storage 4.5.2-next.20 → 4.5.2-next.32
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 +32 -0
- package/lib/.tsbuildinfo +3 -0
- package/lib/Storage.js +18 -23
- package/lib/Storage.js.map +1 -1
- package/lib/index.js +0 -4
- package/lib/index.js.map +1 -1
- package/lib/providers/AWSS3Provider.js +1 -5
- package/lib/providers/AWSS3Provider.js.map +1 -1
- package/lib-esm/.tsbuildinfo +3 -0
- package/lib-esm/Storage.d.ts +0 -4
- package/lib-esm/Storage.js +19 -24
- package/lib-esm/Storage.js.map +1 -1
- package/lib-esm/index.d.ts +0 -4
- package/lib-esm/index.js +0 -4
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/providers/AWSS3Provider.d.ts +0 -4
- package/lib-esm/providers/AWSS3Provider.js +2 -6
- package/lib-esm/providers/AWSS3Provider.js.map +1 -1
- package/package.json +8 -3
- package/src/Storage.ts +24 -24
- package/src/index.ts +0 -5
- package/src/providers/AWSS3Provider.ts +2 -7
- package/build.js +0 -5
- package/dist/aws-amplify-storage.js +0 -58936
- package/dist/aws-amplify-storage.js.map +0 -1
- package/dist/aws-amplify-storage.min.js +0 -226
- package/dist/aws-amplify-storage.min.js.map +0 -1
- package/index.js +0 -7
- package/lib/Storage.d.ts +0 -108
- package/lib/common/S3ClientUtils.d.ts +0 -33
- package/lib/common/StorageConstants.d.ts +0 -4
- package/lib/common/StorageErrorStrings.d.ts +0 -16
- package/lib/common/StorageUtils.d.ts +0 -4
- package/lib/index.d.ts +0 -8
- package/lib/providers/AWSS3Provider.d.ts +0 -87
- package/lib/providers/AWSS3ProviderManagedUpload.d.ts +0 -41
- package/lib/providers/AWSS3UploadTask.d.ts +0 -107
- package/lib/providers/axios-http-handler.d.ts +0 -40
- package/lib/providers/index.d.ts +0 -1
- package/lib/types/AWSS3Provider.d.ts +0 -122
- package/lib/types/Provider.d.ts +0 -22
- package/lib/types/Storage.d.ts +0 -79
- package/lib/types/index.d.ts +0 -3
- package/webpack.config.dev.js +0 -6
package/src/Storage.ts
CHANGED
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
* and limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
Amplify,
|
|
16
|
+
ConsoleLogger as Logger,
|
|
17
|
+
parseAWSExports,
|
|
18
|
+
} from '@aws-amplify/core';
|
|
15
19
|
import { AWSS3Provider } from './providers';
|
|
16
20
|
import {
|
|
17
21
|
StorageCopySource,
|
|
@@ -130,11 +134,11 @@ export class Storage {
|
|
|
130
134
|
logger.debug('configure Storage');
|
|
131
135
|
if (!config) return this._config;
|
|
132
136
|
|
|
133
|
-
const amplifyConfig =
|
|
137
|
+
const amplifyConfig = parseAWSExports(config);
|
|
134
138
|
|
|
135
|
-
const
|
|
139
|
+
const storageConfig = amplifyConfig.Storage ?? {};
|
|
136
140
|
|
|
137
|
-
const
|
|
141
|
+
const defaultProviderConfigKeys = [
|
|
138
142
|
'bucket',
|
|
139
143
|
'region',
|
|
140
144
|
'level',
|
|
@@ -147,32 +151,33 @@ export class Storage {
|
|
|
147
151
|
'SSEKMSKeyId',
|
|
148
152
|
];
|
|
149
153
|
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
const checkConfigKeysFromArray = (k: string[]) =>
|
|
153
|
-
k.find(k => isInStorageArrayKeys(k));
|
|
154
|
+
const hasDefaultProviderConfigKeys = (config: object) =>
|
|
155
|
+
Object.keys(config).find(key => defaultProviderConfigKeys.includes(key));
|
|
154
156
|
|
|
155
157
|
if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
!amplifyConfig.Storage[DEFAULT_PROVIDER]
|
|
158
|
+
hasDefaultProviderConfigKeys(storageConfig) &&
|
|
159
|
+
!storageConfig[DEFAULT_PROVIDER]
|
|
159
160
|
) {
|
|
160
|
-
|
|
161
|
+
storageConfig[DEFAULT_PROVIDER] = {};
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
Object.entries(
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
Object.entries(storageConfig).forEach(([key, value]) => {
|
|
165
|
+
if (
|
|
166
|
+
key &&
|
|
167
|
+
defaultProviderConfigKeys.includes(key) &&
|
|
168
|
+
value !== undefined
|
|
169
|
+
) {
|
|
170
|
+
storageConfig[DEFAULT_PROVIDER][key] = value;
|
|
171
|
+
delete storageConfig[key];
|
|
167
172
|
}
|
|
168
173
|
});
|
|
169
174
|
|
|
170
175
|
// only update new values for each provider
|
|
171
|
-
Object.keys(
|
|
172
|
-
if (typeof
|
|
176
|
+
Object.keys(storageConfig).forEach(providerName => {
|
|
177
|
+
if (typeof storageConfig[providerName] !== 'string') {
|
|
173
178
|
this._config[providerName] = {
|
|
174
179
|
...this._config[providerName],
|
|
175
|
-
...
|
|
180
|
+
...storageConfig[providerName],
|
|
176
181
|
};
|
|
177
182
|
}
|
|
178
183
|
});
|
|
@@ -440,8 +445,3 @@ const getInstance = () => {
|
|
|
440
445
|
|
|
441
446
|
export const StorageInstance: Storage = getInstance();
|
|
442
447
|
Amplify.register(StorageInstance);
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* @deprecated use named import
|
|
446
|
-
*/
|
|
447
|
-
export default Storage;
|
package/src/index.ts
CHANGED
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
import { Storage, StorageInstance } from './Storage';
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated use named import
|
|
18
|
-
*/
|
|
19
|
-
export default StorageInstance;
|
|
20
|
-
|
|
21
16
|
export { Storage as StorageClass, StorageInstance as Storage };
|
|
22
17
|
export * from './providers';
|
|
23
18
|
export * from './types';
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
import {
|
|
14
14
|
ConsoleLogger as Logger,
|
|
15
15
|
Credentials,
|
|
16
|
-
Parser,
|
|
17
16
|
ICredentials,
|
|
18
17
|
StorageHelper,
|
|
19
18
|
Hub,
|
|
19
|
+
parseAWSExports,
|
|
20
20
|
} from '@aws-amplify/core';
|
|
21
21
|
import {
|
|
22
22
|
S3Client,
|
|
@@ -137,7 +137,7 @@ export class AWSS3Provider implements StorageProvider {
|
|
|
137
137
|
public configure(config?): object {
|
|
138
138
|
logger.debug('configure Storage', config);
|
|
139
139
|
if (!config) return this._config;
|
|
140
|
-
const amplifyConfig =
|
|
140
|
+
const amplifyConfig = parseAWSExports(config);
|
|
141
141
|
this._config = Object.assign({}, this._config, amplifyConfig.Storage);
|
|
142
142
|
if (!this._config.bucket) {
|
|
143
143
|
logger.debug('Do not have bucket yet');
|
|
@@ -857,8 +857,3 @@ export class AWSS3Provider implements StorageProvider {
|
|
|
857
857
|
return s3client;
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* @deprecated use named import
|
|
863
|
-
*/
|
|
864
|
-
export default AWSS3Provider;
|