from-schema
Version:
Infer TypeScript types from JSON schemas
58 lines (57 loc) • 1.83 kB
TypeScript
export declare const string: {
readonly bsonType: "string";
readonly description: "Some text i guess lmao";
};
export declare const bool: {
readonly bsonType: "bool";
readonly description: "Either true or false";
};
export declare const long: {
readonly bsonType: "long";
readonly description: "Any number, should probably be constrained at some point";
};
export declare const int: {
readonly bsonType: "int";
readonly description: "Any integer";
};
export declare const whole: {
readonly bsonType: "long";
readonly description: "Any whole number";
readonly minimum: 0;
};
export declare const double: {
readonly bsonType: "double";
readonly description: "A double-precision floating point number";
};
export declare const natural: {
readonly bsonType: "long";
readonly description: "Any natural number";
readonly minimum: 1;
};
export declare const objectId: {
readonly bsonType: "objectId";
readonly description: "BSON ObjectId";
};
export declare const date: {
readonly bsonType: "date";
readonly description: "BSON Date";
};
export declare const email: {
readonly bsonType: "string";
readonly format: "email";
};
export declare const uid: {
readonly bsonType: "string";
readonly pattern: "^[0-9a-f]{24}$";
readonly description: "MongoDB UID (24 character hex string)";
};
export declare const uuidv4: {
readonly bsonType: "string";
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
readonly description: "UUID v4 (36 character hex string)";
};
export declare const uuidv5: {
readonly bsonType: "string";
readonly pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
readonly description: "UUID v5 (36 character hex string)";
};