deps.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.AutoEncryptionLoggerLevel = exports.aws4 = exports.saslprep = exports.Snappy = exports.ZStandard = 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.ZStandard = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `@mongodb-js/zstd` not found. Please install it to enable zstd compression'));
  28. try {
  29. exports.ZStandard = require('@mongodb-js/zstd');
  30. }
  31. catch { } // eslint-disable-line
  32. exports.Snappy = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `snappy` not found. Please install it to enable snappy compression'));
  33. try {
  34. // Ensure you always wrap an optional require in the try block NODE-3199
  35. exports.Snappy = require('snappy');
  36. try {
  37. exports.Snappy[exports.PKG_VERSION] = (0, utils_1.parsePackageVersion)(require('snappy/package.json'));
  38. }
  39. catch { } // eslint-disable-line
  40. }
  41. catch { } // eslint-disable-line
  42. exports.saslprep = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `saslprep` not found.' +
  43. ' Please install it to enable Stringprep Profile for User Names and Passwords'));
  44. try {
  45. // Ensure you always wrap an optional require in the try block NODE-3199
  46. exports.saslprep = require('saslprep');
  47. }
  48. catch { } // eslint-disable-line
  49. exports.aws4 = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `aws4` not found. Please install it to enable AWS authentication'));
  50. try {
  51. // Ensure you always wrap an optional require in the try block NODE-3199
  52. exports.aws4 = require('aws4');
  53. }
  54. catch { } // eslint-disable-line
  55. /** @public */
  56. exports.AutoEncryptionLoggerLevel = Object.freeze({
  57. FatalError: 0,
  58. Error: 1,
  59. Warning: 2,
  60. Info: 3,
  61. Trace: 4
  62. });
  63. //# sourceMappingURL=deps.js.map