deps.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.AutoEncryptionLoggerLevel = exports.aws4 = exports.saslprep = exports.Snappy = exports.Kerberos = exports.PKG_VERSION = void 0;
  4. const error_1 = require("./error");
  5. const utils_1 = require("./utils");
  6. exports.PKG_VERSION = Symbol('kPkgVersion');
  7. function makeErrorModule(error) {
  8. const props = error ? { kModuleError: error } : {};
  9. return new Proxy(props, {
  10. get: (_, key) => {
  11. if (key === 'kModuleError') {
  12. return error;
  13. }
  14. throw error;
  15. },
  16. set: () => {
  17. throw error;
  18. }
  19. });
  20. }
  21. exports.Kerberos = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `kerberos` not found. Please install it to enable kerberos authentication'));
  22. try {
  23. // Ensure you always wrap an optional require in the try block NODE-3199
  24. exports.Kerberos = require('kerberos');
  25. }
  26. catch { } // eslint-disable-line
  27. exports.Snappy = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `snappy` not found. Please install it to enable snappy compression'));
  28. try {
  29. // Ensure you always wrap an optional require in the try block NODE-3199
  30. exports.Snappy = require('snappy');
  31. try {
  32. exports.Snappy[exports.PKG_VERSION] = (0, utils_1.parsePackageVersion)(require('snappy/package.json'));
  33. }
  34. catch { } // eslint-disable-line
  35. }
  36. catch { } // eslint-disable-line
  37. exports.saslprep = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `saslprep` not found.' +
  38. ' Please install it to enable Stringprep Profile for User Names and Passwords'));
  39. try {
  40. // Ensure you always wrap an optional require in the try block NODE-3199
  41. exports.saslprep = require('saslprep');
  42. }
  43. catch { } // eslint-disable-line
  44. exports.aws4 = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `aws4` not found. Please install it to enable AWS authentication'));
  45. try {
  46. // Ensure you always wrap an optional require in the try block NODE-3199
  47. exports.aws4 = require('aws4');
  48. }
  49. catch { } // eslint-disable-line
  50. /** @public */
  51. exports.AutoEncryptionLoggerLevel = Object.freeze({
  52. FatalError: 0,
  53. Error: 1,
  54. Warning: 2,
  55. Info: 3,
  56. Trace: 4
  57. });
  58. //# sourceMappingURL=deps.js.map