Rocky_Mountain_Vending/.pnpm-store/v10/files/6a/516208e50dfb60431b72d5d053e2b23aa35e78b53d91caea05c04ff7bbb50987f8e2f65865df15cdcd25c31f4daa1935901e5a09afa11dd998da940985ac6d
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

42 lines
1.6 KiB
Text

import { NormalizedSchema } from "@smithy/core/schema";
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
import { SerdeContext } from "../SerdeContext";
import { FromStringShapeDeserializer } from "./FromStringShapeDeserializer";
export class HttpInterceptingShapeDeserializer extends SerdeContext {
codecDeserializer;
stringDeserializer;
constructor(codecDeserializer, codecSettings) {
super();
this.codecDeserializer = codecDeserializer;
this.stringDeserializer = new FromStringShapeDeserializer(codecSettings);
}
setSerdeContext(serdeContext) {
this.stringDeserializer.setSerdeContext(serdeContext);
this.codecDeserializer.setSerdeContext(serdeContext);
this.serdeContext = serdeContext;
}
read(schema, data) {
const ns = NormalizedSchema.of(schema);
const traits = ns.getMergedTraits();
const toString = this.serdeContext?.utf8Encoder ?? toUtf8;
if (traits.httpHeader || traits.httpResponseCode) {
return this.stringDeserializer.read(ns, toString(data));
}
if (traits.httpPayload) {
if (ns.isBlobSchema()) {
const toBytes = this.serdeContext?.utf8Decoder ?? fromUtf8;
if (typeof data === "string") {
return toBytes(data);
}
return data;
}
else if (ns.isStringSchema()) {
if ("byteLength" in data) {
return toString(data);
}
return data;
}
}
return this.codecDeserializer.read(ns, data);
}
}