Rocky_Mountain_Vending/.pnpm-store/v10/files/7c/86310dbe9d821cf0ad37ea0dc91f7c517167fe21ecdecabfc4f69960ce54486a4ce3f8152cb2321dd710f2694082e74cb6c74d2027ba2e22bbe343ab389f2f
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

49 lines
2.4 KiB
Text

import { loadSmithyRpcV2CborErrorCode, SmithyRpcV2CborProtocol } from "@smithy/core/cbor";
import { NormalizedSchema, TypeRegistry } from "@smithy/core/schema";
import { ProtocolLib } from "../ProtocolLib";
export class AwsSmithyRpcV2CborProtocol extends SmithyRpcV2CborProtocol {
awsQueryCompatible;
mixin;
constructor({ defaultNamespace, awsQueryCompatible, }) {
super({ defaultNamespace });
this.awsQueryCompatible = !!awsQueryCompatible;
this.mixin = new ProtocolLib(this.awsQueryCompatible);
}
async serializeRequest(operationSchema, input, context) {
const request = await super.serializeRequest(operationSchema, input, context);
if (this.awsQueryCompatible) {
request.headers["x-amzn-query-mode"] = "true";
}
return request;
}
async handleError(operationSchema, context, response, dataObject, metadata) {
if (this.awsQueryCompatible) {
this.mixin.setQueryCompatError(dataObject, response);
}
const errorName = (() => {
const compatHeader = response.headers["x-amzn-query-error"];
if (compatHeader && this.awsQueryCompatible) {
return compatHeader.split(";")[0];
}
return loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
})();
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorName, this.options.defaultNamespace, response, dataObject, metadata, this.awsQueryCompatible ? this.mixin.findQueryCompatibleError : undefined);
const ns = NormalizedSchema.of(errorSchema);
const message = dataObject.message ?? dataObject.Message ?? "Unknown";
const ErrorCtor = TypeRegistry.for(errorSchema[1]).getErrorCtor(errorSchema) ?? Error;
const exception = new ErrorCtor(message);
const output = {};
for (const [name, member] of ns.structIterator()) {
if (dataObject[name] != null) {
output[name] = this.deserializer.readValue(member, dataObject[name]);
}
}
if (this.awsQueryCompatible) {
this.mixin.queryCompatOutput(dataObject, output);
}
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
$fault: ns.getMergedTraits().error,
message,
}, output), dataObject);
}
}