Skip to content

Commit 9337e4e

Browse files
chore: revert aws sdk PR (#28379)
1 parent 2877454 commit 9337e4e

File tree

3 files changed

+596
-1045
lines changed

3 files changed

+596
-1045
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@
7070
"prepare": "husky install"
7171
},
7272
"devDependencies": {
73-
"@aws-sdk/client-s3": "3.450.0",
74-
"@aws-sdk/credential-providers": "3.450.0",
73+
"@aws-sdk/credential-providers": "3.53.0",
7574
"@cypress/questions-remain": "1.0.1",
7675
"@cypress/request": "^3.0.0",
7776
"@cypress/request-promise": "^5.0.0",
@@ -127,6 +126,7 @@
127126
"@urql/introspection": "^0.3.0",
128127
"ascii-table": "0.0.9",
129128
"autobarrel": "^1.1.0",
129+
"aws-sdk": "2.814.0",
130130
"babel-eslint": "10.1.0",
131131
"bluebird": "3.5.3",
132132
"bluebird-retry": "0.11.0",

scripts/binary/s3-api.ts

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const debug = require('debug')('cypress:binary')
22
import la from 'lazy-ass'
33
import is from 'check-more-types'
4-
import { CopyObjectCommandInput, CopyObjectCommandOutput, ObjectCannedACL, S3 } from '@aws-sdk/client-s3'
4+
import S3 from 'aws-sdk/clients/s3'
55

66
export const hasOnlyStringValues = (o) => {
77
return Object.values(o).every((v) => is.unemptyString(v))
@@ -22,11 +22,9 @@ export const s3helpers = {
2222
}
2323

2424
return new S3({
25-
credentials: {
26-
accessKeyId: aws.accessKeyId,
27-
secretAccessKey: aws.secretAccessKey,
28-
sessionToken: aws.sessionToken,
29-
},
25+
accessKeyId: aws.accessKeyId,
26+
secretAccessKey: aws.secretAccessKey,
27+
sessionToken: aws.sessionToken,
3028
})
3129
},
3230

@@ -85,12 +83,12 @@ export const s3helpers = {
8583
* and ACL 'public-read'
8684
*/
8785
copyS3 (sourceKey: string, destinationKey: string, bucket: string,
88-
contentType: string, acl: ObjectCannedACL,
89-
s3: S3): Promise<CopyObjectCommandOutput> {
86+
contentType: S3.ContentType, acl: S3.ObjectCannedACL,
87+
s3: S3): Promise<S3.CopyObjectOutput> {
9088
return new Promise((resolve, reject) => {
9189
debug('copying %s in bucket %s to %s', sourceKey, bucket, destinationKey)
9290

93-
const params: CopyObjectCommandInput = {
91+
const params: S3.CopyObjectRequest = {
9492
Bucket: bucket,
9593
CopySource: `${bucket}/${sourceKey}`,
9694
Key: destinationKey,
@@ -118,7 +116,7 @@ export const s3helpers = {
118116
* but the returned object has these prefixes stripped. Thus if we set
119117
* a single "x-amz-meta-user: gleb", the resolved object will be simply {user: "gleb"}
120118
*/
121-
getUserMetadata (bucket: string, key: string, s3: S3): Promise<Record<string, string>> {
119+
getUserMetadata (bucket: string, key: string, s3: S3): Promise<S3.Metadata> {
122120
return new Promise((resole, reject) => {
123121
debug('getting user metadata from %s %s', bucket, key)
124122

@@ -141,15 +139,15 @@ export const s3helpers = {
141139
* Setting user metadata can be accomplished with copying the object back onto itself
142140
* with replaced metadata object.
143141
*/
144-
setUserMetadata (bucket: string, key: string, metadata: Record<string, string>,
145-
contentType: string, acl: ObjectCannedACL, s3: S3): Promise<CopyObjectCommandOutput> {
142+
setUserMetadata (bucket: string, key: string, metadata: S3.Metadata,
143+
contentType: S3.ContentType, acl: S3.ObjectCannedACL, s3: S3): Promise<S3.CopyObjectOutput> {
146144
la(hasOnlyStringValues(metadata),
147145
'metadata object can only have string values', metadata)
148146

149147
return new Promise((resolve, reject) => {
150148
debug('setting metadata to %o for %s %s', metadata, bucket, key)
151149

152-
const params: CopyObjectCommandInput = {
150+
const params: S3.CopyObjectRequest = {
153151
Bucket: bucket,
154152
CopySource: `${bucket}/${key}`,
155153
Key: key,

0 commit comments

Comments
 (0)