@aws-amplify/storage 6.8.4-unstable.893d9cf.0 → 6.8.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.
Files changed (23) hide show
  1. package/dist/cjs/providers/s3/utils/client/s3data/deleteObject.js +5 -1
  2. package/dist/cjs/providers/s3/utils/client/s3data/deleteObject.js.map +1 -1
  3. package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js +4 -3
  4. package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js.map +1 -1
  5. package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js +15 -1
  6. package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js.map +1 -1
  7. package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.d.ts +1 -1
  8. package/dist/esm/providers/s3/utils/client/s3data/deleteObject.mjs +5 -2
  9. package/dist/esm/providers/s3/utils/client/s3data/deleteObject.mjs.map +1 -1
  10. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.d.ts +1 -1
  11. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs +4 -4
  12. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs.map +1 -1
  13. package/dist/esm/providers/s3/utils/client/s3data/types.d.ts +3473 -907
  14. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.d.ts +15 -2
  15. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs +14 -1
  16. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs.map +1 -1
  17. package/package.json +118 -118
  18. package/s3/package.json +1 -1
  19. package/src/providers/s3/apis/internal/list.ts +1 -1
  20. package/src/providers/s3/utils/client/s3data/deleteObject.ts +6 -1
  21. package/src/providers/s3/utils/client/s3data/listObjectsV2.ts +6 -3
  22. package/src/providers/s3/utils/client/s3data/types.ts +3470 -908
  23. package/src/providers/s3/utils/client/utils/deserializeHelpers.ts +17 -2
@@ -69,6 +69,9 @@ export declare const deserializeTimestamp: (value: string) => Date | undefined;
69
69
  * Create a function deserializing a string to an enum value. If the string is not a valid enum value, it throws a
70
70
  * StorageError.
71
71
  *
72
+ * This utility is ONLY preferred if the enum value is critical. Since the enum values are hard-coded, new enum values
73
+ * returned from service would break the library.
74
+ *
72
75
  * @example
73
76
  * ```typescript
74
77
  * const deserializeStringEnum = createStringEnumDeserializer(['a', 'b', 'c'] as const, 'FieldName');
@@ -81,7 +84,17 @@ export declare const deserializeTimestamp: (value: string) => Date | undefined;
81
84
  *
82
85
  * @internal
83
86
  */
84
- export declare const createStringEnumDeserializer: <T extends readonly string[]>(enumValues: T, fieldName: string) => (value: any) => T extends (infer E)[] ? E : never;
87
+ export declare const createStringEnumDeserializer: <T extends readonly string[]>(enumValues: T, fieldName: string) => (value: any) => T extends readonly (infer E)[] ? E : never;
88
+ /**
89
+ * Deserializes a string to a string tag type. The function simply casts the parsed string into a given string tag type.
90
+ * It does NOT validate the string value against the string tag. This behavior is the same to AWS SDK parsing logic of
91
+ * string tag types.
92
+ *
93
+ * If you need to verify the string value, you must use {@link createStringEnumDeserializer} instead.
94
+ *
95
+ * @internal
96
+ */
97
+ export declare const deserializeStringTag: <T extends string>(value: any) => T;
85
98
  /**
86
99
  * Function that makes sure the deserializer receives non-empty array.
87
100
  *
@@ -91,7 +104,7 @@ export declare const emptyArrayGuard: <T extends any[]>(value: any, deserializer
91
104
  /**
92
105
  * @internal
93
106
  */
94
- export declare const deserializeMetadata: (headers: Headers) => Record<string, string>;
107
+ export declare const deserializeMetadata: (headers: Headers) => Record<string, string> | undefined;
95
108
  export type ParsedError = Awaited<ReturnType<ErrorParser>> & {};
96
109
  /**
97
110
  * Internal-only method to create a new StorageError from a service error with AWS SDK-compatible interfaces
@@ -83,6 +83,9 @@ const deserializeTimestamp = (value) => {
83
83
  * Create a function deserializing a string to an enum value. If the string is not a valid enum value, it throws a
84
84
  * StorageError.
85
85
  *
86
+ * This utility is ONLY preferred if the enum value is critical. Since the enum values are hard-coded, new enum values
87
+ * returned from service would break the library.
88
+ *
86
89
  * @example
87
90
  * ```typescript
88
91
  * const deserializeStringEnum = createStringEnumDeserializer(['a', 'b', 'c'] as const, 'FieldName');
@@ -111,6 +114,16 @@ const createStringEnumDeserializer = (enumValues, fieldName) => {
111
114
  };
112
115
  return deserializeStringEnum;
113
116
  };
117
+ /**
118
+ * Deserializes a string to a string tag type. The function simply casts the parsed string into a given string tag type.
119
+ * It does NOT validate the string value against the string tag. This behavior is the same to AWS SDK parsing logic of
120
+ * string tag types.
121
+ *
122
+ * If you need to verify the string value, you must use {@link createStringEnumDeserializer} instead.
123
+ *
124
+ * @internal
125
+ */
126
+ const deserializeStringTag = (value) => String(value);
114
127
  /**
115
128
  * Function that makes sure the deserializer receives non-empty array.
116
129
  *
@@ -159,5 +172,5 @@ const deserializeCompletedPartList = (input) => input.map(item => map(item, {
159
172
  ChecksumCRC32: 'ChecksumCRC32',
160
173
  }));
161
174
 
162
- export { buildStorageServiceError, createStringEnumDeserializer, deserializeBoolean, deserializeCompletedPartList, deserializeMetadata, deserializeNumber, deserializeTimestamp, emptyArrayGuard, map };
175
+ export { buildStorageServiceError, createStringEnumDeserializer, deserializeBoolean, deserializeCompletedPartList, deserializeMetadata, deserializeNumber, deserializeStringTag, deserializeTimestamp, emptyArrayGuard, map };
163
176
  //# sourceMappingURL=deserializeHelpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deserializeHelpers.mjs","sources":["../../../../../../../src/providers/s3/utils/client/utils/deserializeHelpers.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageError } from '../../../../../errors/StorageError';\n/**\n * Maps an object to a new object using the provided instructions.\n * The instructions are a map of the returning mapped object's property names to a single instruction of how to map the\n * value from the original object to the new object. There are two types of instructions:\n *\n * 1. A string representing the property name of the original object to map to the new object. The value mapped from\n * the original object will be the same as the value in the new object, and it can ONLY be string.\n *\n * 2. An array of two elements. The first element is the property name of the original object to map to the new object.\n * The second element is a function that takes the value from the original object and returns the value to be mapped to\n * the new object. The function can return any type.\n *\n * Example:\n * ```typescript\n * const input = {\n * Foo: 'foo',\n * BarList: [{value: 'bar1'}, {value: 'bar2'}]\n * }\n * const output = map(input, {\n * someFoo: 'Foo',\n * bar: ['BarList', (barList) => barList.map(bar => bar.value)]\n * baz: 'Baz' // Baz does not exist in input, so it will not be in the output.\n * });\n * // output = { someFoo: 'foo', bar: ['bar1', 'bar2'] }\n * ```\n *\n * @param obj The object containing the data to compose mapped object.\n * @param instructions The instructions mapping the object values to the new object.\n * @returns A new object with the mapped values.\n *\n * @internal\n */\nexport const map = (obj, instructions) => {\n const result = {};\n for (const [key, instruction] of Object.entries(instructions)) {\n const [accessor, deserializer] = Array.isArray(instruction)\n ? instruction\n : [instruction];\n if (Object.prototype.hasOwnProperty.call(obj, accessor)) {\n result[key] = deserializer\n ? deserializer(obj[accessor])\n : String(obj[accessor]);\n }\n }\n return result;\n};\n/**\n * Deserializes a string to a number. Returns undefined if input is undefined.\n *\n * @internal\n */\nexport const deserializeNumber = (value) => value ? Number(value) : undefined;\n/**\n * Deserializes a string to a boolean. Returns undefined if input is undefined. Returns true if input is 'true',\n * otherwise false.\n *\n * @internal\n */\nexport const deserializeBoolean = (value) => {\n return value ? value === 'true' : undefined;\n};\n/**\n * Deserializes a string to a Date. Returns undefined if input is undefined.\n * It supports epoch timestamp; rfc3339(cannot have a UTC, fractional precision supported); rfc7231(section 7.1.1.1)\n *\n * @see https://www.epoch101.com/\n * @see https://datatracker.ietf.org/doc/html/rfc3339.html#section-5.6\n * @see https://datatracker.ietf.org/doc/html/rfc7231.html#section-7.1.1.1\n *\n * @note For bundle size consideration, we use Date constructor to parse the timestamp string. There might be slight\n * difference among browsers.\n *\n * @internal\n */\nexport const deserializeTimestamp = (value) => {\n return value ? new Date(value) : undefined;\n};\n/**\n * Create a function deserializing a string to an enum value. If the string is not a valid enum value, it throws a\n * StorageError.\n *\n * @example\n * ```typescript\n * const deserializeStringEnum = createStringEnumDeserializer(['a', 'b', 'c'] as const, 'FieldName');\n * const deserializedArray = ['a', 'b', 'c'].map(deserializeStringEnum);\n * // deserializedArray = ['a', 'b', 'c']\n *\n * const invalidValue = deserializeStringEnum('d');\n * // Throws InvalidFieldName: Invalid FieldName: d\n * ```\n *\n * @internal\n */\nexport const createStringEnumDeserializer = (enumValues, fieldName) => {\n const deserializeStringEnum = (value) => {\n const parsedEnumValue = value\n ? enumValues.find(enumValue => enumValue === value)\n : undefined;\n if (!parsedEnumValue) {\n throw new StorageError({\n name: `Invalid${fieldName}`,\n message: `Invalid ${fieldName}: ${value}`,\n recoverySuggestion: 'This is likely to be a bug. Please reach out to library authors.',\n });\n }\n return parsedEnumValue;\n };\n return deserializeStringEnum;\n};\n/**\n * Function that makes sure the deserializer receives non-empty array.\n *\n * @internal\n */\nexport const emptyArrayGuard = (value, deserializer) => {\n if (value === '') {\n return [];\n }\n const valueArray = (Array.isArray(value) ? value : [value]).filter(e => e != null);\n return deserializer(valueArray);\n};\n/**\n * @internal\n */\nexport const deserializeMetadata = (headers) => {\n const objectMetadataHeaderPrefix = 'x-amz-meta-';\n const deserialized = Object.keys(headers)\n .filter(header => header.startsWith(objectMetadataHeaderPrefix))\n .reduce((acc, header) => {\n acc[header.replace(objectMetadataHeaderPrefix, '')] = headers[header];\n return acc;\n }, {});\n return Object.keys(deserialized).length > 0 ? deserialized : undefined;\n};\n/**\n * Internal-only method to create a new StorageError from a service error with AWS SDK-compatible interfaces\n * @param error - The output of a service error parser, with AWS SDK-compatible interface(e.g. $metadata)\n * @returns A new StorageError.\n *\n * @internal\n */\nexport const buildStorageServiceError = (error) => new StorageError({\n name: error.name,\n message: error.message,\n metadata: error.$metadata,\n});\n/**\n * Internal-only method used for deserializing the parts of a multipart upload.\n *\n * @internal\n */\nexport const deserializeCompletedPartList = (input) => input.map(item => map(item, {\n PartNumber: ['PartNumber', deserializeNumber],\n ETag: 'ETag',\n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,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC;AACvE,SAAS,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK;AACjC,QAAQ,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;AAC7E,QAAQ,OAAO,GAAG;AAClB,KAAK,EAAE,EAAE,CAAC;AACV,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,YAAY,GAAG,SAAS;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,wBAAwB,GAAG,CAAC,KAAK,KAAK,IAAI,YAAY,CAAC;AACpE,IAAI,IAAI,EAAE,KAAK,CAAC,IAAI;AACpB,IAAI,OAAO,EAAE,KAAK,CAAC,OAAO;AAC1B,IAAI,QAAQ,EAAE,KAAK,CAAC,SAAS;AAC7B,CAAC;AACD;AACA;AACA;AACA;AACA;AACY,MAAC,4BAA4B,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE;AACnF,IAAI,UAAU,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC;AACjD,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,aAAa,EAAE,eAAe;AAClC,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"deserializeHelpers.mjs","sources":["../../../../../../../src/providers/s3/utils/client/utils/deserializeHelpers.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageError } from '../../../../../errors/StorageError';\n/**\n * Maps an object to a new object using the provided instructions.\n * The instructions are a map of the returning mapped object's property names to a single instruction of how to map the\n * value from the original object to the new object. There are two types of instructions:\n *\n * 1. A string representing the property name of the original object to map to the new object. The value mapped from\n * the original object will be the same as the value in the new object, and it can ONLY be string.\n *\n * 2. An array of two elements. The first element is the property name of the original object to map to the new object.\n * The second element is a function that takes the value from the original object and returns the value to be mapped to\n * the new object. The function can return any type.\n *\n * Example:\n * ```typescript\n * const input = {\n * Foo: 'foo',\n * BarList: [{value: 'bar1'}, {value: 'bar2'}]\n * }\n * const output = map(input, {\n * someFoo: 'Foo',\n * bar: ['BarList', (barList) => barList.map(bar => bar.value)]\n * baz: 'Baz' // Baz does not exist in input, so it will not be in the output.\n * });\n * // output = { someFoo: 'foo', bar: ['bar1', 'bar2'] }\n * ```\n *\n * @param obj The object containing the data to compose mapped object.\n * @param instructions The instructions mapping the object values to the new object.\n * @returns A new object with the mapped values.\n *\n * @internal\n */\nexport const map = (obj, instructions) => {\n const result = {};\n for (const [key, instruction] of Object.entries(instructions)) {\n const [accessor, deserializer] = Array.isArray(instruction)\n ? instruction\n : [instruction];\n if (Object.prototype.hasOwnProperty.call(obj, accessor)) {\n result[key] = deserializer\n ? deserializer(obj[accessor])\n : String(obj[accessor]);\n }\n }\n return result;\n};\n/**\n * Deserializes a string to a number. Returns undefined if input is undefined.\n *\n * @internal\n */\nexport const deserializeNumber = (value) => value ? Number(value) : undefined;\n/**\n * Deserializes a string to a boolean. Returns undefined if input is undefined. Returns true if input is 'true',\n * otherwise false.\n *\n * @internal\n */\nexport const deserializeBoolean = (value) => {\n return value ? value === 'true' : undefined;\n};\n/**\n * Deserializes a string to a Date. Returns undefined if input is undefined.\n * It supports epoch timestamp; rfc3339(cannot have a UTC, fractional precision supported); rfc7231(section 7.1.1.1)\n *\n * @see https://www.epoch101.com/\n * @see https://datatracker.ietf.org/doc/html/rfc3339.html#section-5.6\n * @see https://datatracker.ietf.org/doc/html/rfc7231.html#section-7.1.1.1\n *\n * @note For bundle size consideration, we use Date constructor to parse the timestamp string. There might be slight\n * difference among browsers.\n *\n * @internal\n */\nexport const deserializeTimestamp = (value) => {\n return value ? new Date(value) : undefined;\n};\n/**\n * Create a function deserializing a string to an enum value. If the string is not a valid enum value, it throws a\n * StorageError.\n *\n * This utility is ONLY preferred if the enum value is critical. Since the enum values are hard-coded, new enum values\n * returned from service would break the library.\n *\n * @example\n * ```typescript\n * const deserializeStringEnum = createStringEnumDeserializer(['a', 'b', 'c'] as const, 'FieldName');\n * const deserializedArray = ['a', 'b', 'c'].map(deserializeStringEnum);\n * // deserializedArray = ['a', 'b', 'c']\n *\n * const invalidValue = deserializeStringEnum('d');\n * // Throws InvalidFieldName: Invalid FieldName: d\n * ```\n *\n * @internal\n */\nexport const createStringEnumDeserializer = (enumValues, fieldName) => {\n const deserializeStringEnum = (value) => {\n const parsedEnumValue = value\n ? enumValues.find(enumValue => enumValue === value)\n : undefined;\n if (!parsedEnumValue) {\n throw new StorageError({\n name: `Invalid${fieldName}`,\n message: `Invalid ${fieldName}: ${value}`,\n recoverySuggestion: 'This is likely to be a bug. Please reach out to library authors.',\n });\n }\n return parsedEnumValue;\n };\n return deserializeStringEnum;\n};\n/**\n * Deserializes a string to a string tag type. The function simply casts the parsed string into a given string tag type.\n * It does NOT validate the string value against the string tag. This behavior is the same to AWS SDK parsing logic of\n * string tag types.\n *\n * If you need to verify the string value, you must use {@link createStringEnumDeserializer} instead.\n *\n * @internal\n */\nexport const deserializeStringTag = (value) => String(value);\n/**\n * Function that makes sure the deserializer receives non-empty array.\n *\n * @internal\n */\nexport const emptyArrayGuard = (value, deserializer) => {\n if (value === '') {\n return [];\n }\n const valueArray = (Array.isArray(value) ? value : [value]).filter(e => e != null);\n return deserializer(valueArray);\n};\n/**\n * @internal\n */\nexport const deserializeMetadata = (headers) => {\n const objectMetadataHeaderPrefix = 'x-amz-meta-';\n const deserialized = Object.keys(headers)\n .filter(header => header.startsWith(objectMetadataHeaderPrefix))\n .reduce((acc, header) => {\n acc[header.replace(objectMetadataHeaderPrefix, '')] = headers[header];\n return acc;\n }, {});\n return Object.keys(deserialized).length > 0 ? deserialized : undefined;\n};\n/**\n * Internal-only method to create a new StorageError from a service error with AWS SDK-compatible interfaces\n * @param error - The output of a service error parser, with AWS SDK-compatible interface(e.g. $metadata)\n * @returns A new StorageError.\n *\n * @internal\n */\nexport const buildStorageServiceError = (error) => new StorageError({\n name: error.name,\n message: error.message,\n metadata: error.$metadata,\n});\n/**\n * Internal-only method used for deserializing the parts of a multipart upload.\n *\n * @internal\n */\nexport const deserializeCompletedPartList = (input) => input.map(item => map(item, {\n PartNumber: ['PartNumber', deserializeNumber],\n ETag: 'ETag',\n ChecksumCRC32: 'ChecksumCRC32',\n}));\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,GAAG,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK;AAC1C,IAAI,MAAM,MAAM,GAAG,EAAE;AACrB,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AACnE,QAAQ,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW;AAClE,cAAc;AACd,cAAc,CAAC,WAAW,CAAC;AAC3B,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE;AACjE,YAAY,MAAM,CAAC,GAAG,CAAC,GAAG;AAC1B,kBAAkB,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC5C,kBAAkB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACvC;AACA;AACA,IAAI,OAAO,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,CAAC,KAAK,KAAK,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG;AACpE;AACA;AACA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;AAChB,IAAI,aAAa,EAAE,eAAe;AAClC,CAAC,CAAC;;;;"}
package/package.json CHANGED
@@ -1,120 +1,120 @@
1
1
  {
2
- "name": "@aws-amplify/storage",
3
- "version": "6.8.4-unstable.893d9cf.0+893d9cf",
4
- "description": "Storage category of aws-amplify",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.mjs",
7
- "react-native": {
8
- "./dist/cjs/index": "./src/index.ts",
9
- "fast-xml-parser": "fast-xml-parser",
10
- "buffer": "buffer"
11
- },
12
- "typings": "./dist/esm/index.d.ts",
13
- "browser": {
14
- "./dist/esm/providers/s3/utils/client/runtime/base64/index.native.mjs": "./dist/esm/providers/s3/utils/client/runtime/base64/index.browser.mjs",
15
- "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/fetch.mjs": "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/xhr.mjs",
16
- "./dist/esm/providers/s3/utils/client/runtime/xmlParser/pureJs.mjs": "./dist/esm/providers/s3/utils/client/runtime/xmlParser/dom.mjs",
17
- "fast-xml-parser": false,
18
- "buffer": false
19
- },
20
- "sideEffects": false,
21
- "publishConfig": {
22
- "access": "public"
23
- },
24
- "scripts": {
25
- "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
26
- "build-with-test": "npm test && npm run build",
27
- "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
28
- "build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
29
- "build:watch": "npm run build:esm-cjs -- --watch",
30
- "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
31
- "clean": "npm run clean:size && rimraf lib-esm lib dist",
32
- "clean:size": "rimraf dual-publish-tmp tmp*",
33
- "format": "echo \"Not implemented\"",
34
- "lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
35
- "lint:fix": "eslint '**/*.{ts,tsx}' --fix",
36
- "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
37
- },
38
- "typesVersions": {
39
- ">=4.2": {
40
- "s3": [
41
- "./dist/esm/providers/s3/index.d.ts"
42
- ],
43
- "internals": [
44
- "./dist/esm/internals/index.d.ts"
45
- ],
46
- "server": [
47
- "./dist/esm/server.d.ts"
48
- ],
49
- "s3/server": [
50
- "./dist/esm/providers/s3/server.d.ts"
51
- ]
52
- }
53
- },
54
- "repository": {
55
- "type": "git",
56
- "url": "https://github.com/aws-amplify/amplify-js.git"
57
- },
58
- "author": "Amazon Web Services",
59
- "license": "Apache-2.0",
60
- "bugs": {
61
- "url": "https://github.com/aws/aws-amplify/issues"
62
- },
63
- "homepage": "https://aws-amplify.github.io/",
64
- "files": [
65
- "dist/cjs",
66
- "dist/esm",
67
- "internals",
68
- "src",
69
- "server",
70
- "s3"
71
- ],
72
- "dependencies": {
73
- "@aws-sdk/types": "3.398.0",
74
- "@smithy/md5-js": "2.0.7",
75
- "buffer": "4.9.2",
76
- "crc-32": "1.2.2",
77
- "fast-xml-parser": "^4.4.1",
78
- "tslib": "^2.5.0"
79
- },
80
- "exports": {
81
- ".": {
82
- "react-native": "./src/index.ts",
83
- "types": "./dist/esm/index.d.ts",
84
- "import": "./dist/esm/index.mjs",
85
- "require": "./dist/cjs/index.js"
86
- },
87
- "./internals": {
88
- "types": "./dist/esm/internals/index.d.ts",
89
- "import": "./dist/esm/internals/index.mjs",
90
- "require": "./dist/cjs/internals/index.js"
91
- },
92
- "./server": {
93
- "types": "./dist/esm/server.d.ts",
94
- "import": "./dist/esm/server.mjs",
95
- "require": "./dist/cjs/server.js"
96
- },
97
- "./s3": {
98
- "react-native": "./src/providers/s3/index.ts",
99
- "types": "./dist/esm/providers/s3/index.d.ts",
100
- "import": "./dist/esm/providers/s3/index.mjs",
101
- "require": "./dist/cjs/providers/s3/index.js"
102
- },
103
- "./s3/server": {
104
- "types": "./dist/esm/providers/s3/server.d.ts",
105
- "import": "./dist/esm/providers/s3/server.mjs",
106
- "require": "./dist/cjs/providers/s3/server.js"
107
- },
108
- "./package.json": "./package.json"
109
- },
110
- "peerDependencies": {
111
- "@aws-amplify/core": "6.11.4-unstable.893d9cf.0+893d9cf"
112
- },
113
- "devDependencies": {
114
- "@aws-amplify/core": "6.11.4-unstable.893d9cf.0+893d9cf",
115
- "@aws-amplify/react-native": "1.1.9-unstable.893d9cf.0+893d9cf",
116
- "@types/node": "20.14.12",
117
- "typescript": "5.0.2"
118
- },
119
- "gitHead": "893d9cf04bf1bb349e1d1a7094cf6507d413d713"
2
+ "name": "@aws-amplify/storage",
3
+ "version": "6.8.4",
4
+ "description": "Storage category of aws-amplify",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.mjs",
7
+ "react-native": {
8
+ "./dist/cjs/index": "./src/index.ts",
9
+ "fast-xml-parser": "fast-xml-parser",
10
+ "buffer": "buffer"
11
+ },
12
+ "typings": "./dist/esm/index.d.ts",
13
+ "browser": {
14
+ "./dist/esm/providers/s3/utils/client/runtime/base64/index.native.mjs": "./dist/esm/providers/s3/utils/client/runtime/base64/index.browser.mjs",
15
+ "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/fetch.mjs": "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/xhr.mjs",
16
+ "./dist/esm/providers/s3/utils/client/runtime/xmlParser/pureJs.mjs": "./dist/esm/providers/s3/utils/client/runtime/xmlParser/dom.mjs",
17
+ "fast-xml-parser": false,
18
+ "buffer": false
19
+ },
20
+ "sideEffects": false,
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
26
+ "build-with-test": "npm test && npm run build",
27
+ "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
28
+ "build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
29
+ "build:watch": "npm run build:esm-cjs -- --watch",
30
+ "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
31
+ "clean": "npm run clean:size && rimraf lib-esm lib dist",
32
+ "clean:size": "rimraf dual-publish-tmp tmp*",
33
+ "format": "echo \"Not implemented\"",
34
+ "lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
35
+ "lint:fix": "eslint '**/*.{ts,tsx}' --fix",
36
+ "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
37
+ },
38
+ "typesVersions": {
39
+ ">=4.2": {
40
+ "s3": [
41
+ "./dist/esm/providers/s3/index.d.ts"
42
+ ],
43
+ "internals": [
44
+ "./dist/esm/internals/index.d.ts"
45
+ ],
46
+ "server": [
47
+ "./dist/esm/server.d.ts"
48
+ ],
49
+ "s3/server": [
50
+ "./dist/esm/providers/s3/server.d.ts"
51
+ ]
52
+ }
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/aws-amplify/amplify-js.git"
57
+ },
58
+ "author": "Amazon Web Services",
59
+ "license": "Apache-2.0",
60
+ "bugs": {
61
+ "url": "https://github.com/aws/aws-amplify/issues"
62
+ },
63
+ "homepage": "https://aws-amplify.github.io/",
64
+ "files": [
65
+ "dist/cjs",
66
+ "dist/esm",
67
+ "internals",
68
+ "src",
69
+ "server",
70
+ "s3"
71
+ ],
72
+ "dependencies": {
73
+ "@aws-sdk/types": "3.398.0",
74
+ "@smithy/md5-js": "2.0.7",
75
+ "buffer": "4.9.2",
76
+ "crc-32": "1.2.2",
77
+ "fast-xml-parser": "^4.4.1",
78
+ "tslib": "^2.5.0"
79
+ },
80
+ "exports": {
81
+ ".": {
82
+ "react-native": "./dist/cjs/index.js",
83
+ "types": "./dist/esm/index.d.ts",
84
+ "import": "./dist/esm/index.mjs",
85
+ "require": "./dist/cjs/index.js"
86
+ },
87
+ "./internals": {
88
+ "types": "./dist/esm/internals/index.d.ts",
89
+ "import": "./dist/esm/internals/index.mjs",
90
+ "require": "./dist/cjs/internals/index.js"
91
+ },
92
+ "./server": {
93
+ "types": "./dist/esm/server.d.ts",
94
+ "import": "./dist/esm/server.mjs",
95
+ "require": "./dist/cjs/server.js"
96
+ },
97
+ "./s3": {
98
+ "react-native": "./dist/cjs/providers/s3/index.js",
99
+ "types": "./dist/esm/providers/s3/index.d.ts",
100
+ "import": "./dist/esm/providers/s3/index.mjs",
101
+ "require": "./dist/cjs/providers/s3/index.js"
102
+ },
103
+ "./s3/server": {
104
+ "types": "./dist/esm/providers/s3/server.d.ts",
105
+ "import": "./dist/esm/providers/s3/server.mjs",
106
+ "require": "./dist/cjs/providers/s3/server.js"
107
+ },
108
+ "./package.json": "./package.json"
109
+ },
110
+ "peerDependencies": {
111
+ "@aws-amplify/core": "^6.1.0"
112
+ },
113
+ "devDependencies": {
114
+ "@aws-amplify/core": "6.11.4",
115
+ "@aws-amplify/react-native": "1.1.9",
116
+ "@types/node": "20.14.12",
117
+ "typescript": "5.0.2"
118
+ },
119
+ "gitHead": "f2ac9929610f7f878f124083ceaf03465113cd44"
120
120
  }
package/s3/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-amplify/storage/s3",
3
3
  "main": "../dist/cjs/providers/s3/index.js",
4
- "react-native": "../src/providers/s3/index.ts",
4
+ "react-native": "../dist/cjs/providers/s3/index.js",
5
5
  "browser": "../dist/esm/providers/s3/index.mjs",
6
6
  "module": "../dist/esm/providers/s3/index.mjs",
7
7
  "typings": "../dist/esm/providers/s3/index.d.ts"
@@ -86,7 +86,7 @@ export const list = async (
86
86
  ContinuationToken: options?.listAll ? undefined : options?.nextToken,
87
87
  Delimiter: getDelimiter(options),
88
88
  ExpectedBucketOwner: options?.expectedBucketOwner,
89
- EncodingType: 'url',
89
+ EncodingType: 'url' as const,
90
90
  };
91
91
  logger.debug(`listing items from "${listParams.Prefix}"`);
92
92
 
@@ -23,10 +23,12 @@ import {
23
23
  validateS3RequiredParameter,
24
24
  } from '../utils';
25
25
  import { validateObjectUrl } from '../../validateObjectUrl';
26
+ import { deserializeStringTag } from '../utils/deserializeHelpers';
26
27
 
27
28
  import type {
28
29
  DeleteObjectCommandInput,
29
30
  DeleteObjectCommandOutput,
31
+ RequestPayer,
30
32
  } from './types';
31
33
  import { defaultConfig, parseXmlError } from './base';
32
34
 
@@ -73,7 +75,10 @@ const deleteObjectDeserializer = async (
73
75
  const content = map(response.headers, {
74
76
  DeleteMarker: ['x-amz-delete-marker', deserializeBoolean],
75
77
  VersionId: 'x-amz-version-id',
76
- RequestCharged: 'x-amz-request-charged',
78
+ RequestCharged: [
79
+ 'x-amz-request-charged',
80
+ deserializeStringTag<RequestPayer>,
81
+ ],
77
82
  });
78
83
 
79
84
  return {
@@ -25,10 +25,13 @@ import {
25
25
  s3TransferHandler,
26
26
  } from '../utils';
27
27
  import { IntegrityError } from '../../../../../errors/IntegrityError';
28
+ import { deserializeStringTag } from '../utils/deserializeHelpers';
28
29
 
29
30
  import type {
31
+ ChecksumAlgorithm,
30
32
  ListObjectsV2CommandInput,
31
33
  ListObjectsV2CommandOutput,
34
+ StorageClass,
32
35
  } from './types';
33
36
  import { defaultConfig, parseXmlError } from './base';
34
37
 
@@ -83,7 +86,7 @@ const listObjectsV2Deserializer = async (
83
86
  ],
84
87
  ContinuationToken: 'ContinuationToken',
85
88
  Delimiter: 'Delimiter',
86
- EncodingType: 'EncodingType',
89
+ EncodingType: ['EncodingType', deserializeStringTag<'url'>],
87
90
  IsTruncated: ['IsTruncated', deserializeBoolean],
88
91
  KeyCount: ['KeyCount', deserializeNumber],
89
92
  MaxKeys: ['MaxKeys', deserializeNumber],
@@ -124,12 +127,12 @@ const deserializeObject = (output: any) =>
124
127
  value => emptyArrayGuard(value, deserializeChecksumAlgorithmList),
125
128
  ],
126
129
  Size: ['Size', deserializeNumber],
127
- StorageClass: 'StorageClass',
130
+ StorageClass: ['StorageClass', deserializeStringTag<StorageClass>],
128
131
  Owner: ['Owner', deserializeOwner],
129
132
  });
130
133
 
131
134
  const deserializeChecksumAlgorithmList = (output: any[]) =>
132
- output.map(entry => String(entry));
135
+ output.map(deserializeStringTag<ChecksumAlgorithm>);
133
136
 
134
137
  const deserializeOwner = (output: any) =>
135
138
  map(output, { DisplayName: 'DisplayName', ID: 'ID' });