1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.serializerMiddleware = void 0;
|
4 | const serializerMiddleware = (options, serializer) => (next, context) => async (args) => {
|
5 | var _a;
|
6 | const endpoint = ((_a = context.endpointV2) === null || _a === void 0 ? void 0 : _a.url) && options.urlParser
|
7 | ? async () => options.urlParser(context.endpointV2.url)
|
8 | : options.endpoint;
|
9 | if (!endpoint) {
|
10 | throw new Error("No valid endpoint provider available.");
|
11 | }
|
12 | const request = await serializer(args.input, { ...options, endpoint });
|
13 | return next({
|
14 | ...args,
|
15 | request,
|
16 | });
|
17 | };
|
18 | exports.serializerMiddleware = serializerMiddleware;
|