Sha256: ce8395749cc51feee96f6c05beaa44266c07122824e0dac954ff3cedc5af33be

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

'use strict';

let defaultModule;
function loadDefaultModule() {
  if (!defaultModule) {
    defaultModule = extension(require('mongodb'));
  }

  return defaultModule;
}

const MongoCryptError = require('./common').MongoCryptError;
function extension(mongodb) {
  const modules = { mongodb };

  modules.stateMachine = require('./stateMachine')(modules);
  modules.autoEncrypter = require('./autoEncrypter')(modules);
  modules.clientEncryption = require('./clientEncryption')(modules);

  return {
    AutoEncrypter: modules.autoEncrypter.AutoEncrypter,
    ClientEncryption: modules.clientEncryption.ClientEncryption,
    MongoCryptError
  };
}

module.exports = {
  extension,
  MongoCryptError,
  get AutoEncrypter() {
    const m = loadDefaultModule();
    delete module.exports.AutoEncrypter;
    module.exports.AutoEncrypter = m.AutoEncrypter;
    return m.AutoEncrypter;
  },
  get ClientEncryption() {
    const m = loadDefaultModule();
    delete module.exports.ClientEncryption;
    module.exports.ClientEncryption = m.ClientEncryption;
    return m.ClientEncryption;
  }
};

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
libmongocrypt-helper-1.7.4.0.1002 ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js
libmongocrypt-helper-1.7.4.0.1001 ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js
libmongocrypt-helper-1.7.4.0.1000 ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js