nestjs-appwrite
Version:
Easier Appwrite integration for your NestJS application.
33 lines (32 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class TypeMetadataStorage {
constructor() {
this.schemas = new Map();
this.properties = [];
this.indexes = [];
this.addSchemaMetadata = (target, options) => {
this.schemas.set(target, options);
};
this.getSchemaMetadata = (target) => {
const schemaMetadata = this.schemas.get(target);
if (!schemaMetadata) {
throw new Error(`Forgot to put Schema decorator for target ${target.name}`);
}
return schemaMetadata;
};
this.addPropertyMetadata = (target, propertyKey, options) => {
this.properties.push({ target, propertyKey, options });
};
this.getClassProperties = (target) => {
return this.properties.filter((property) => property.target === target);
};
this.addIndexMetadata = (target, propertyKey, options) => {
this.indexes.push({ target, propertyKey, options });
};
this.getClassIndexes = (target) => {
return this.indexes.filter((index) => index.target === target);
};
}
}
exports.default = new TypeMetadataStorage();