@aws-sdk/middleware-serde
Advanced tools
Comparing version 3.183.0 to 3.186.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06) | ||
**Note:** Version bump only for package @aws-sdk/middleware-serde | ||
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03) | ||
@@ -8,0 +16,0 @@ |
@@ -1,16 +0,32 @@ | ||
export const deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => { | ||
const { response } = await next(args); | ||
try { | ||
const parsed = await deserializer(response, options); | ||
return { | ||
response, | ||
output: parsed, | ||
}; | ||
} | ||
catch (error) { | ||
Object.defineProperty(error, "$response", { | ||
value: response, | ||
}); | ||
throw error; | ||
} | ||
import { __awaiter, __generator } from "tslib"; | ||
export var deserializerMiddleware = function (options, deserializer) { | ||
return function (next, context) { | ||
return function (args) { return __awaiter(void 0, void 0, void 0, function () { | ||
var response, parsed, error_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, next(args)]; | ||
case 1: | ||
response = (_a.sent()).response; | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 4, , 5]); | ||
return [4, deserializer(response, options)]; | ||
case 3: | ||
parsed = _a.sent(); | ||
return [2, { | ||
response: response, | ||
output: parsed, | ||
}]; | ||
case 4: | ||
error_1 = _a.sent(); | ||
Object.defineProperty(error_1, "$response", { | ||
value: response, | ||
}); | ||
throw error_1; | ||
case 5: return [2]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
}; |
import { deserializerMiddleware } from "./deserializerMiddleware"; | ||
import { serializerMiddleware } from "./serializerMiddleware"; | ||
export const deserializerMiddlewareOption = { | ||
export var deserializerMiddlewareOption = { | ||
name: "deserializerMiddleware", | ||
@@ -9,3 +9,3 @@ step: "deserialize", | ||
}; | ||
export const serializerMiddlewareOption = { | ||
export var serializerMiddlewareOption = { | ||
name: "serializerMiddleware", | ||
@@ -18,3 +18,3 @@ step: "serialize", | ||
return { | ||
applyToStack: (commandStack) => { | ||
applyToStack: function (commandStack) { | ||
commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption); | ||
@@ -21,0 +21,0 @@ commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption); |
@@ -1,13 +0,26 @@ | ||
export const serializerMiddleware = (options, serializer) => (next, context) => async (args) => { | ||
const endpoint = context.endpointV2?.url && options.urlParser | ||
? async () => options.urlParser(context.endpointV2.url) | ||
: options.endpoint; | ||
if (!endpoint) { | ||
throw new Error("No valid endpoint provider available."); | ||
} | ||
const request = await serializer(args.input, { ...options, endpoint }); | ||
return next({ | ||
...args, | ||
request, | ||
}); | ||
import { __assign, __awaiter, __generator } from "tslib"; | ||
export var serializerMiddleware = function (options, serializer) { | ||
return function (next, context) { | ||
return function (args) { return __awaiter(void 0, void 0, void 0, function () { | ||
var endpoint, request; | ||
var _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
endpoint = ((_a = context.endpointV2) === null || _a === void 0 ? void 0 : _a.url) && options.urlParser | ||
? function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
return [2, options.urlParser(context.endpointV2.url)]; | ||
}); }); } | ||
: options.endpoint; | ||
if (!endpoint) { | ||
throw new Error("No valid endpoint provider available."); | ||
} | ||
return [4, serializer(args.input, __assign(__assign({}, options), { endpoint: endpoint }))]; | ||
case 1: | ||
request = _b.sent(); | ||
return [2, next(__assign(__assign({}, args), { request: request }))]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
}; |
{ | ||
"name": "@aws-sdk/middleware-serde", | ||
"version": "3.183.0", | ||
"version": "3.186.0", | ||
"scripts": { | ||
@@ -23,3 +23,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"dependencies": { | ||
"@aws-sdk/types": "3.183.0", | ||
"@aws-sdk/types": "3.186.0", | ||
"tslib": "^2.3.1" | ||
@@ -26,0 +26,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57690
219
+ Added@aws-sdk/types@3.186.0(transitive)
- Removed@aws-sdk/types@3.183.0(transitive)
Updated@aws-sdk/types@3.186.0