@aws-amplify/core
Version:
Core category of aws-amplify
1 lines • 1.62 kB
Source Map (JSON)
{"version":3,"file":"composeTransferHandler.mjs","sources":["../../../../src/clients/internal/composeTransferHandler.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Compose a transfer handler with a core transfer handler and a list of middleware.\n * @param coreHandler Core transfer handler\n * @param middleware\tList of middleware\n * @returns A transfer handler whose option type is the union of the core\n * \ttransfer handler's option type and the middleware's option type.\n * @internal\n */\nexport const composeTransferHandler = (coreHandler, middleware) => (request, options) => {\n const context = {};\n let composedHandler = (composeHandlerRequest) => coreHandler(composeHandlerRequest, options);\n for (let i = middleware.length - 1; i >= 0; i--) {\n const m = middleware[i];\n const resolvedMiddleware = m(options);\n composedHandler = resolvedMiddleware(composedHandler, context);\n }\n return composedHandler(request);\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,WAAW,EAAE,UAAU,KAAK,CAAC,OAAO,EAAE,OAAO,KAAK;AACzF,IAAI,MAAM,OAAO,GAAG,EAAE;AACtB,IAAI,IAAI,eAAe,GAAG,CAAC,qBAAqB,KAAK,WAAW,CAAC,qBAAqB,EAAE,OAAO,CAAC;AAChG,IAAI,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;AACrD,QAAQ,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;AAC/B,QAAQ,MAAM,kBAAkB,GAAG,CAAC,CAAC,OAAO,CAAC;AAC7C,QAAQ,eAAe,GAAG,kBAAkB,CAAC,eAAe,EAAE,OAAO,CAAC;AACtE;AACA,IAAI,OAAO,eAAe,CAAC,OAAO,CAAC;AACnC;;;;"}