bson_value.ts 863 B

12345678910111213141516171819202122232425262728293031
  1. import { BSON_MAJOR_VERSION } from './constants';
  2. import { type InspectFn } from './parser/utils';
  3. /** @public */
  4. export abstract class BSONValue {
  5. /** @public */
  6. public abstract get _bsontype(): string;
  7. /** @internal */
  8. get [Symbol.for('@@mdb.bson.version')](): typeof BSON_MAJOR_VERSION {
  9. return BSON_MAJOR_VERSION;
  10. }
  11. [Symbol.for('nodejs.util.inspect.custom')](
  12. depth?: number,
  13. options?: unknown,
  14. inspect?: InspectFn
  15. ): string {
  16. return this.inspect(depth, options, inspect);
  17. }
  18. /**
  19. * @public
  20. * Prints a human-readable string of BSON value information
  21. * If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify
  22. */
  23. public abstract inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
  24. /** @internal */
  25. abstract toExtendedJSON(): unknown;
  26. }