Rocky_Mountain_Vending/.pnpm-store/v10/files/96/6e47de80148786a851c020213f30884c30fdcf0e24c3dc92fbd6aee519a20fb4334efd70906f4a0528d01af887bee4f9433843d420f4d5ca819a07d476d50b
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

65 lines
2.1 KiB
Text

export class TypeRegistry {
namespace;
schemas;
exceptions;
static registries = new Map();
constructor(namespace, schemas = new Map(), exceptions = new Map()) {
this.namespace = namespace;
this.schemas = schemas;
this.exceptions = exceptions;
}
static for(namespace) {
if (!TypeRegistry.registries.has(namespace)) {
TypeRegistry.registries.set(namespace, new TypeRegistry(namespace));
}
return TypeRegistry.registries.get(namespace);
}
register(shapeId, schema) {
const qualifiedName = this.normalizeShapeId(shapeId);
const registry = TypeRegistry.for(qualifiedName.split("#")[0]);
registry.schemas.set(qualifiedName, schema);
}
getSchema(shapeId) {
const id = this.normalizeShapeId(shapeId);
if (!this.schemas.has(id)) {
throw new Error(`@smithy/core/schema - schema not found for ${id}`);
}
return this.schemas.get(id);
}
registerError(es, ctor) {
const $error = es;
const registry = TypeRegistry.for($error[1]);
registry.schemas.set($error[1] + "#" + $error[2], $error);
registry.exceptions.set($error, ctor);
}
getErrorCtor(es) {
const $error = es;
const registry = TypeRegistry.for($error[1]);
return registry.exceptions.get($error);
}
getBaseException() {
for (const exceptionKey of this.exceptions.keys()) {
if (Array.isArray(exceptionKey)) {
const [, ns, name] = exceptionKey;
const id = ns + "#" + name;
if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
return exceptionKey;
}
}
}
return undefined;
}
find(predicate) {
return [...this.schemas.values()].find(predicate);
}
clear() {
this.schemas.clear();
this.exceptions.clear();
}
normalizeShapeId(shapeId) {
if (shapeId.includes("#")) {
return shapeId;
}
return this.namespace + "#" + shapeId;
}
}