@aws-amplify/storage 5.0.3 → 5.0.4-unstable.4
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/lib/types/Storage.d.ts +5 -5
- package/lib-esm/types/Storage.d.ts +5 -5
- package/package.json +3 -3
- package/src/types/Storage.ts +41 -25
package/lib/types/Storage.d.ts
CHANGED
|
@@ -44,11 +44,11 @@ declare type StorageOperationConfig<T extends StorageProvider | StorageProviderW
|
|
|
44
44
|
} : LastParameter<T[Exclude<U, 'copy'>]> & {
|
|
45
45
|
provider: ReturnType<T['getProviderName']>;
|
|
46
46
|
};
|
|
47
|
-
export declare type StorageGetConfig<T
|
|
48
|
-
export declare type StoragePutConfig<T
|
|
49
|
-
export declare type StorageRemoveConfig<T
|
|
50
|
-
export declare type StorageListConfig<T
|
|
51
|
-
export declare type StorageCopyConfig<T
|
|
47
|
+
export declare type StorageGetConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'get'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'get'>, T>;
|
|
48
|
+
export declare type StoragePutConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'put'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'put'>, T>;
|
|
49
|
+
export declare type StorageRemoveConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'remove'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'remove'>, T>;
|
|
50
|
+
export declare type StorageListConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'list'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'list'>, T>;
|
|
51
|
+
export declare type StorageCopyConfig<T extends Record<string, any>> = T extends StorageProviderWithCopy ? StorageOperationConfig<T, 'copy'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'copy'>, T>;
|
|
52
52
|
/**
|
|
53
53
|
* Utility type for checking if the generic type is a provider or a Record that has the key 'provider'.
|
|
54
54
|
* If it's a provider, check if it's the S3 Provider, use the default type else use the generic's 'get' method
|
|
@@ -44,11 +44,11 @@ declare type StorageOperationConfig<T extends StorageProvider | StorageProviderW
|
|
|
44
44
|
} : LastParameter<T[Exclude<U, 'copy'>]> & {
|
|
45
45
|
provider: ReturnType<T['getProviderName']>;
|
|
46
46
|
};
|
|
47
|
-
export declare type StorageGetConfig<T
|
|
48
|
-
export declare type StoragePutConfig<T
|
|
49
|
-
export declare type StorageRemoveConfig<T
|
|
50
|
-
export declare type StorageListConfig<T
|
|
51
|
-
export declare type StorageCopyConfig<T
|
|
47
|
+
export declare type StorageGetConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'get'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'get'>, T>;
|
|
48
|
+
export declare type StoragePutConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'put'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'put'>, T>;
|
|
49
|
+
export declare type StorageRemoveConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'remove'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'remove'>, T>;
|
|
50
|
+
export declare type StorageListConfig<T extends Record<string, any>> = T extends StorageProvider ? StorageOperationConfig<T, 'list'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'list'>, T>;
|
|
51
|
+
export declare type StorageCopyConfig<T extends Record<string, any>> = T extends StorageProviderWithCopy ? StorageOperationConfig<T, 'copy'> : StorageOperationConfigMap<StorageOperationConfig<AWSS3Provider, 'copy'>, T>;
|
|
52
52
|
/**
|
|
53
53
|
* Utility type for checking if the generic type is a provider or a Record that has the key 'provider'.
|
|
54
54
|
* If it's a provider, check if it's the S3 Provider, use the default type else use the generic's 'get' method
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/storage",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4-unstable.4+8f6dd7084",
|
|
4
4
|
"description": "Storage category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"src"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@aws-amplify/core": "5.0.
|
|
47
|
+
"@aws-amplify/core": "5.0.4-unstable.4+8f6dd7084",
|
|
48
48
|
"@aws-sdk/client-s3": "3.6.1",
|
|
49
49
|
"@aws-sdk/s3-request-presigner": "3.6.1",
|
|
50
50
|
"@aws-sdk/util-create-request": "3.6.1",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@types/sinon": "^7.5.1"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "8f6dd70842bc5bbec2188f5cd896cf298b09f750"
|
|
106
106
|
}
|
package/src/types/Storage.ts
CHANGED
|
@@ -79,28 +79,45 @@ type StorageOperationConfig<
|
|
|
79
79
|
provider: ReturnType<T['getProviderName']>;
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
export type StorageGetConfig<T
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
export type
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
82
|
+
export type StorageGetConfig<T extends Record<string, any>> =
|
|
83
|
+
T extends StorageProvider
|
|
84
|
+
? StorageOperationConfig<T, 'get'>
|
|
85
|
+
: StorageOperationConfigMap<
|
|
86
|
+
StorageOperationConfig<AWSS3Provider, 'get'>,
|
|
87
|
+
T
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
export type StoragePutConfig<T extends Record<string, any>> =
|
|
91
|
+
T extends StorageProvider
|
|
92
|
+
? StorageOperationConfig<T, 'put'>
|
|
93
|
+
: StorageOperationConfigMap<
|
|
94
|
+
StorageOperationConfig<AWSS3Provider, 'put'>,
|
|
95
|
+
T
|
|
96
|
+
>;
|
|
97
|
+
|
|
98
|
+
export type StorageRemoveConfig<T extends Record<string, any>> =
|
|
99
|
+
T extends StorageProvider
|
|
100
|
+
? StorageOperationConfig<T, 'remove'>
|
|
101
|
+
: StorageOperationConfigMap<
|
|
102
|
+
StorageOperationConfig<AWSS3Provider, 'remove'>,
|
|
103
|
+
T
|
|
104
|
+
>;
|
|
105
|
+
|
|
106
|
+
export type StorageListConfig<T extends Record<string, any>> =
|
|
107
|
+
T extends StorageProvider
|
|
108
|
+
? StorageOperationConfig<T, 'list'>
|
|
109
|
+
: StorageOperationConfigMap<
|
|
110
|
+
StorageOperationConfig<AWSS3Provider, 'list'>,
|
|
111
|
+
T
|
|
112
|
+
>;
|
|
113
|
+
|
|
114
|
+
export type StorageCopyConfig<T extends Record<string, any>> =
|
|
115
|
+
T extends StorageProviderWithCopy
|
|
116
|
+
? StorageOperationConfig<T, 'copy'>
|
|
117
|
+
: StorageOperationConfigMap<
|
|
118
|
+
StorageOperationConfig<AWSS3Provider, 'copy'>,
|
|
119
|
+
T
|
|
120
|
+
>;
|
|
104
121
|
|
|
105
122
|
/**
|
|
106
123
|
* Utility type for checking if the generic type is a provider or a Record that has the key 'provider'.
|
|
@@ -124,9 +141,8 @@ type PickProviderOutput<
|
|
|
124
141
|
: Promise<any>
|
|
125
142
|
: DefaultOutput;
|
|
126
143
|
|
|
127
|
-
export type StorageGetOutput<
|
|
128
|
-
T
|
|
129
|
-
> = PickProviderOutput<Promise<S3ProviderGetOuput<T>>, T, 'get'>;
|
|
144
|
+
export type StorageGetOutput<T extends StorageProvider | Record<string, any>> =
|
|
145
|
+
PickProviderOutput<Promise<S3ProviderGetOuput<T>>, T, 'get'>;
|
|
130
146
|
|
|
131
147
|
export type StoragePutOutput<T> = PickProviderOutput<
|
|
132
148
|
S3ProviderPutOutput<T>,
|