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>
33 lines
1.2 KiB
Text
33 lines
1.2 KiB
Text
import { NormalizedSchema } from "@smithy/core/schema";
|
|
import { ToStringShapeSerializer } from "./ToStringShapeSerializer";
|
|
export class HttpInterceptingShapeSerializer {
|
|
codecSerializer;
|
|
stringSerializer;
|
|
buffer;
|
|
constructor(codecSerializer, codecSettings, stringSerializer = new ToStringShapeSerializer(codecSettings)) {
|
|
this.codecSerializer = codecSerializer;
|
|
this.stringSerializer = stringSerializer;
|
|
}
|
|
setSerdeContext(serdeContext) {
|
|
this.codecSerializer.setSerdeContext(serdeContext);
|
|
this.stringSerializer.setSerdeContext(serdeContext);
|
|
}
|
|
write(schema, value) {
|
|
const ns = NormalizedSchema.of(schema);
|
|
const traits = ns.getMergedTraits();
|
|
if (traits.httpHeader || traits.httpLabel || traits.httpQuery) {
|
|
this.stringSerializer.write(ns, value);
|
|
this.buffer = this.stringSerializer.flush();
|
|
return;
|
|
}
|
|
return this.codecSerializer.write(ns, value);
|
|
}
|
|
flush() {
|
|
if (this.buffer !== undefined) {
|
|
const buffer = this.buffer;
|
|
this.buffer = undefined;
|
|
return buffer;
|
|
}
|
|
return this.codecSerializer.flush();
|
|
}
|
|
}
|