1 | {"version":3,"file":"putObjectJob.mjs","sources":["../../../../../../src/providers/s3/apis/uploadData/putObjectJob.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 { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { calculateContentMd5, resolveS3ConfigAndInput } from '../../utils';\nimport { putObject } from '../../utils/client';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\n/**\n * Get a function the returns a promise to call putObject API to S3.\n *\n * @internal\n */\nexport const putObjectJob = ({ options: uploadDataOptions, key, data }, abortSignal, totalLength) => async () => {\n const { bucket, keyPrefix, s3Config, isObjectLockEnabled } = await resolveS3ConfigAndInput(Amplify, uploadDataOptions);\n const finalKey = keyPrefix + key;\n const { contentDisposition, contentEncoding, contentType = 'application/octet-stream', metadata, onProgress, } = uploadDataOptions ?? {};\n const { ETag: eTag, VersionId: versionId } = await putObject({\n ...s3Config,\n abortSignal,\n onUploadProgress: onProgress,\n userAgentValue: getStorageUserAgentValue(StorageAction.UploadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n Body: data,\n ContentType: contentType,\n ContentDisposition: contentDisposition,\n ContentEncoding: contentEncoding,\n Metadata: metadata,\n ContentMD5: isObjectLockEnabled\n ? await calculateContentMd5(data)\n : undefined,\n });\n return {\n key,\n eTag,\n versionId,\n contentType,\n metadata,\n size: totalLength,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,WAAW,KAAK,YAAY;AACjH,IAAI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAA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