UNPKG

@opra/common

Version:
29 lines (28 loc) 778 B
import { __decorate, __metadata } from "tslib"; import { vg } from 'valgen'; import { DECODER, ENCODER } from '../../constants.js'; import { SimpleType } from '../simple-type.js'; let ObjectIdType = class ObjectIdType { constructor(attributes) { if (attributes) Object.assign(this, attributes); } [DECODER]() { return vg.isObjectId({ coerce: true }); } [ENCODER]() { return vg.isObjectId({ coerce: true }); } }; ObjectIdType = __decorate([ SimpleType({ name: 'ObjectId', description: 'A MongoDB ObjectID value', nameMappings: { js: 'object', json: 'string', }, }), __metadata("design:paramtypes", [Object]) ], ObjectIdType); export { ObjectIdType };