UNPKG

@aws-amplify/core

Version:
1 lines 1.33 kB
{"version":3,"file":"extendedEncodeURIComponent.mjs","sources":["../../../../../../src/clients/middleware/signing/utils/extendedEncodeURIComponent.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Wraps encodeURIComponent to encode additional characters to fully adhere to RFC 3986.\n * @see https://github.com/aws/aws-sdk-js-v3/blob/86b432c464150069678b25ff88d57c2ca26e75a2/packages/smithy-client/src/extended-encode-uri-component.ts#L7\n *\n * @param uri URI string to encode\n * @returns RFC 3986 encoded string\n *\n * @internal\n */\nexport const extendedEncodeURIComponent = (uri) => {\n // Match characters normally not encoded by `encodeURIComponent`\n const extendedCharacters = /[!'()*]/g;\n return encodeURIComponent(uri).replace(extendedCharacters, hexEncode);\n};\nconst hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,0BAA0B,GAAG,CAAC,GAAG,KAAK;AACnD;AACA,IAAI,MAAM,kBAAkB,GAAG,UAAU;AACzC,IAAI,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,SAAS,CAAC;AACzE;AACA,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;;;;"}