@aws-amplify/storage 6.8.4-rn-exports.f28cd66.0 → 6.8.4-unstable.4a1f10b.0

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 (92) hide show
  1. package/dist/cjs/errors/types/validation.js +1 -1
  2. package/dist/cjs/errors/types/validation.js.map +1 -1
  3. package/dist/cjs/errors/utils/assertValidationError.js +1 -2
  4. package/dist/cjs/errors/utils/assertValidationError.js.map +1 -1
  5. package/dist/cjs/internals/apis/list.js +1 -2
  6. package/dist/cjs/internals/apis/list.js.map +1 -1
  7. package/dist/cjs/providers/s3/apis/copy.js +1 -2
  8. package/dist/cjs/providers/s3/apis/copy.js.map +1 -1
  9. package/dist/cjs/providers/s3/apis/downloadData.js +1 -2
  10. package/dist/cjs/providers/s3/apis/downloadData.js.map +1 -1
  11. package/dist/cjs/providers/s3/apis/getProperties.js +1 -2
  12. package/dist/cjs/providers/s3/apis/getProperties.js.map +1 -1
  13. package/dist/cjs/providers/s3/apis/getUrl.js +1 -2
  14. package/dist/cjs/providers/s3/apis/getUrl.js.map +1 -1
  15. package/dist/cjs/providers/s3/apis/internal/copy.js +1 -1
  16. package/dist/cjs/providers/s3/apis/internal/copy.js.map +1 -1
  17. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadCache.js +1 -1
  18. package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadCache.js.map +1 -1
  19. package/dist/cjs/providers/s3/apis/list.js +1 -2
  20. package/dist/cjs/providers/s3/apis/list.js.map +1 -1
  21. package/dist/cjs/providers/s3/apis/remove.js +1 -2
  22. package/dist/cjs/providers/s3/apis/remove.js.map +1 -1
  23. package/dist/cjs/providers/s3/apis/server/copy.js +1 -2
  24. package/dist/cjs/providers/s3/apis/server/copy.js.map +1 -1
  25. package/dist/cjs/providers/s3/apis/server/getProperties.js +1 -2
  26. package/dist/cjs/providers/s3/apis/server/getProperties.js.map +1 -1
  27. package/dist/cjs/providers/s3/apis/server/getUrl.js +1 -2
  28. package/dist/cjs/providers/s3/apis/server/getUrl.js.map +1 -1
  29. package/dist/cjs/providers/s3/apis/server/list.js +1 -2
  30. package/dist/cjs/providers/s3/apis/server/list.js.map +1 -1
  31. package/dist/cjs/providers/s3/apis/server/remove.js +1 -2
  32. package/dist/cjs/providers/s3/apis/server/remove.js.map +1 -1
  33. package/dist/cjs/providers/s3/apis/uploadData.js +1 -2
  34. package/dist/cjs/providers/s3/apis/uploadData.js.map +1 -1
  35. package/dist/cjs/providers/s3/utils/client/runtime/base64/index.browser.js +1 -2
  36. package/dist/cjs/providers/s3/utils/client/runtime/base64/index.browser.js.map +1 -1
  37. package/dist/cjs/providers/s3/utils/client/runtime/base64/index.native.js +1 -2
  38. package/dist/cjs/providers/s3/utils/client/runtime/base64/index.native.js.map +1 -1
  39. package/dist/cjs/providers/s3/utils/client/s3data/deleteObject.js +5 -1
  40. package/dist/cjs/providers/s3/utils/client/s3data/deleteObject.js.map +1 -1
  41. package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js +4 -3
  42. package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js.map +1 -1
  43. package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js +15 -1
  44. package/dist/cjs/providers/s3/utils/client/utils/deserializeHelpers.js.map +1 -1
  45. package/dist/cjs/providers/s3/utils/client/utils/serializeHelpers.js +2 -2
  46. package/dist/cjs/providers/s3/utils/client/utils/serializeHelpers.js.map +1 -1
  47. package/dist/cjs/providers/s3/utils/userAgent.js +1 -2
  48. package/dist/cjs/providers/s3/utils/userAgent.js.map +1 -1
  49. package/dist/cjs/providers/s3/utils/validateMultipartUploadXML.js +1 -2
  50. package/dist/cjs/providers/s3/utils/validateMultipartUploadXML.js.map +1 -1
  51. package/dist/cjs/providers/s3/utils/validateObjectUrl.js +1 -2
  52. package/dist/cjs/providers/s3/utils/validateObjectUrl.js.map +1 -1
  53. package/dist/esm/internals/apis/copy.d.ts +2 -1
  54. package/dist/esm/internals/apis/getUrl.d.ts +2 -1
  55. package/dist/esm/internals/apis/listPaths/resolveLocationsForCurrentSession.d.ts +2 -2
  56. package/dist/esm/internals/apis/uploadData.d.ts +2 -1
  57. package/dist/esm/providers/s3/apis/internal/copy.mjs +1 -1
  58. package/dist/esm/providers/s3/apis/internal/copy.mjs.map +1 -1
  59. package/dist/esm/providers/s3/apis/internal/downloadData.d.ts +1 -1
  60. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.d.ts +2 -2
  61. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.mjs +1 -1
  62. package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.mjs.map +1 -1
  63. package/dist/esm/providers/s3/utils/client/s3control/getDataAccess.d.ts +2 -2
  64. package/dist/esm/providers/s3/utils/client/s3control/listCallerAccessGrants.d.ts +2 -2
  65. package/dist/esm/providers/s3/utils/client/s3data/abortMultipartUpload.d.ts +4 -4
  66. package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.d.ts +4 -4
  67. package/dist/esm/providers/s3/utils/client/s3data/copyObject.d.ts +4 -4
  68. package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.d.ts +5 -5
  69. package/dist/esm/providers/s3/utils/client/s3data/deleteObject.d.ts +4 -4
  70. package/dist/esm/providers/s3/utils/client/s3data/deleteObject.mjs +5 -2
  71. package/dist/esm/providers/s3/utils/client/s3data/deleteObject.mjs.map +1 -1
  72. package/dist/esm/providers/s3/utils/client/s3data/getObject.d.ts +4 -4
  73. package/dist/esm/providers/s3/utils/client/s3data/headObject.d.ts +4 -4
  74. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.d.ts +5 -5
  75. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs +4 -4
  76. package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs.map +1 -1
  77. package/dist/esm/providers/s3/utils/client/s3data/listParts.d.ts +4 -4
  78. package/dist/esm/providers/s3/utils/client/s3data/putObject.d.ts +4 -4
  79. package/dist/esm/providers/s3/utils/client/s3data/types.d.ts +3473 -907
  80. package/dist/esm/providers/s3/utils/client/s3data/uploadPart.d.ts +4 -4
  81. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.d.ts +16 -3
  82. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs +14 -1
  83. package/dist/esm/providers/s3/utils/client/utils/deserializeHelpers.mjs.map +1 -1
  84. package/dist/esm/providers/s3/utils/client/utils/integrityHelpers.d.ts +2 -2
  85. package/dist/esm/providers/s3/utils/client/utils/parsePayload.d.ts +1 -1
  86. package/dist/esm/providers/s3/utils/hexUtils.d.ts +2 -2
  87. package/package.json +6 -7
  88. package/src/providers/s3/apis/internal/list.ts +1 -1
  89. package/src/providers/s3/utils/client/s3data/deleteObject.ts +6 -1
  90. package/src/providers/s3/utils/client/s3data/listObjectsV2.ts +6 -3
  91. package/src/providers/s3/utils/client/s3data/types.ts +3470 -908
  92. package/src/providers/s3/utils/client/utils/deserializeHelpers.ts +17 -2
@@ -6,17 +6,17 @@ export declare const uploadPart: (config: {
6
6
  responseType?: "blob" | "text" | undefined;
7
7
  service?: string | undefined;
8
8
  endpointResolver?: (((options: import("@aws-amplify/core/internals/aws-client-utils").EndpointResolverOptions, input?: any) => Endpoint) & ((options: import("./base").S3EndpointResolverOptions, apiInput?: {
9
- Bucket?: string | undefined;
10
- } | undefined) => {
9
+ Bucket?: string;
10
+ }) => {
11
11
  url: URL;
12
12
  })) | undefined;
13
- retryDecider?: (((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>) & import("../utils/createRetryDecider").RetryDecider) | undefined;
13
+ retryDecider?: (((response?: HttpResponse | undefined, error?: unknown, middlewareContext?: import("@aws-amplify/core/internals/aws-client-utils").MiddlewareContext) => Promise<import("@aws-amplify/core/internals/aws-client-utils").RetryDeciderOutput>) & import("../utils/createRetryDecider").RetryDecider) | undefined;
14
14
  computeDelay?: ((attempt: number) => number) | undefined;
15
15
  userAgentValue?: string | undefined;
16
16
  useAccelerateEndpoint?: boolean | undefined;
17
17
  uriEscapePath?: boolean | undefined;
18
18
  } & {
19
- credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | ((options?: import("@aws-amplify/core/internals/aws-client-utils").CredentialsProviderOptions | undefined) => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
19
+ credentials: import("@aws-amplify/core/internals/aws-client-utils").Credentials | ((options?: import("@aws-amplify/core/internals/aws-client-utils").CredentialsProviderOptions) => Promise<import("@aws-amplify/core/internals/aws-client-utils").Credentials>);
20
20
  region: string;
21
21
  onDownloadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
22
22
  onUploadProgress?: ((event: import("../../../../..").TransferProgressEvent) => void) | undefined;
@@ -37,7 +37,7 @@ type InferInstructionResultType<T extends Instruction<any>> = (T extends Propert
37
37
  *
38
38
  * @internal
39
39
  */
40
- export declare const map: <Instructions extends Record<string, Instruction<any>>>(obj: Record<string, any>, instructions: Instructions) => { [K in keyof Instructions]: Instructions[K] extends infer T ? T extends Instructions[K] ? T extends PropertyNameWithSubsequentDeserializer<infer R> ? R : string : never : never; };
40
+ export declare const map: <Instructions extends Record<string, Instruction<any>>>(obj: Record<string, any>, instructions: Instructions) => { [K in keyof Instructions]: InferInstructionResultType<Instructions[K]>; };
41
41
  /**
42
42
  * Deserializes a string to a number. Returns undefined if input is undefined.
43
43
  *
@@ -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 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,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AAO,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;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK;AAC7C,IAAI,OAAO,KAAK,GAAG,KAAK,KAAK,MAAM,GAAG,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,oBAAoB,GAAG,CAAC,KAAK,KAAK;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AACY,MAAC,mBAAmB,GAAG,CAAC,OAAO,KAAK;AAChD,IAAI,MAAM,0BAA0B,GAAG,aAAa;AACpD,IAAI,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO;AAC5C,SAAS,MAAM,CAAC,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,4 +1,4 @@
1
- export declare const isNil: <T>(value?: T | undefined) => boolean;
1
+ export declare const isNil: <T>(value?: T) => boolean;
2
2
  export declare const bothNilOrEqual: (original?: string, output?: string) => boolean;
3
3
  /**
4
4
  * This function is used to determine if a value is an object.
@@ -7,7 +7,7 @@ export declare const bothNilOrEqual: (original?: string, output?: string) => boo
7
7
  * @param value
8
8
  * @returns
9
9
  */
10
- export declare const isObject: <T>(value?: T | undefined) => boolean;
10
+ export declare const isObject: <T>(value?: T) => boolean;
11
11
  /**
12
12
  * This function is used to compare two objects and determine if they are equal.
13
13
  * It handles nested objects and arrays as well.
@@ -13,6 +13,6 @@ import { ErrorParser, HttpResponse } from '@aws-amplify/core/internals/aws-clien
13
13
  * @internal
14
14
  */
15
15
  export declare const createXmlErrorParser: ({ noErrorWrapping, }?: {
16
- noErrorWrapping?: boolean | undefined;
16
+ noErrorWrapping?: boolean;
17
17
  }) => ErrorParser;
18
18
  export declare const parseXmlBody: (response: HttpResponse) => Promise<any>;
@@ -1,3 +1,3 @@
1
- export declare const hexToUint8Array: (hexString: string) => Uint8Array;
2
- export declare const hexToArrayBuffer: (hexString: string) => ArrayBufferLike;
1
+ export declare const hexToUint8Array: (hexString: string) => Uint8Array<ArrayBuffer>;
2
+ export declare const hexToArrayBuffer: (hexString: string) => ArrayBuffer;
3
3
  export declare const hexToBase64: (hexString: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/storage",
3
- "version": "6.8.4-rn-exports.f28cd66.0+f28cd66",
3
+ "version": "6.8.4-unstable.4a1f10b.0+4a1f10b",
4
4
  "description": "Storage category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -108,13 +108,12 @@
108
108
  "./package.json": "./package.json"
109
109
  },
110
110
  "peerDependencies": {
111
- "@aws-amplify/core": "6.11.4-rn-exports.f28cd66.0+f28cd66"
111
+ "@aws-amplify/core": "6.11.4-unstable.4a1f10b.0+4a1f10b"
112
112
  },
113
113
  "devDependencies": {
114
- "@aws-amplify/core": "6.11.4-rn-exports.f28cd66.0+f28cd66",
115
- "@aws-amplify/react-native": "1.1.9-rn-exports.f28cd66.0+f28cd66",
116
- "@types/node": "20.14.12",
117
- "typescript": "5.0.2"
114
+ "@aws-amplify/core": "6.11.4-unstable.4a1f10b.0+4a1f10b",
115
+ "@aws-amplify/react-native": "1.1.9-unstable.4a1f10b.0+4a1f10b",
116
+ "@types/node": "20.14.12"
118
117
  },
119
- "gitHead": "f28cd66f2ef4f928e237ccb209020b58f2d7a419"
118
+ "gitHead": "4a1f10b282a29e3c35c1621eeb6880a84f929078"
120
119
  }
@@ -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' });