Skip to content
Snippets Groups Projects
onDeleteAccount.js 8.09 MiB
Newer Older
Hugo SUBTIL's avatar
Hugo SUBTIL committed
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

const requestFactory = __webpack_require__(2);

const hydrateAndFilter = __webpack_require__(353);

const categorization = __webpack_require__(1270);
const log = __webpack_require__(1287);
Hugo SUBTIL's avatar
Hugo SUBTIL committed

module.exports = {
  BaseKonnector: __webpack_require__(1288),
  CookieKonnector: __webpack_require__(1368),
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  cozyClient: __webpack_require__(485),
  errors: __webpack_require__(1294),
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  log,
  saveFiles: __webpack_require__(1290),
  saveBills: __webpack_require__(1289),
  saveIdentity: __webpack_require__(1334),
  linkBankOperations: __webpack_require__(1311),
  addData: __webpack_require__(1310),
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  hydrateAndFilter,
  htmlToPDF: (__webpack_require__(1369).htmlToPDF),
  createCozyPDFDocument: (__webpack_require__(1369).createCozyPDFDocument),
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  filterData: deprecate(hydrateAndFilter, 'Use hydrateAndFilter now. filterData will be removed in cozy-konnector-libs@4'),
  updateOrCreate: __webpack_require__(1333),
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  request: deprecate(requestFactory, 'Use requestFactory instead of request. It will be removed in cozy-konnector-libs@4'),
  requestFactory,
  retry: __webpack_require__(1291),
  wrapIfSentrySetUp: (__webpack_require__(1335).wrapIfSentrySetUp),
  Document: __webpack_require__(1370),
  signin: __webpack_require__(1330),
  submitForm: __webpack_require__(1330),
  scrape: __webpack_require__(1372),
  mkdirp: __webpack_require__(1293),
  normalizeFilename: __webpack_require__(1373),
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  utils: __webpack_require__(484),
  solveCaptcha: __webpack_require__(1374),
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  createCategorizer: categorization.createCategorizer,
  categorize: categorization.categorize,
  manifest: __webpack_require__(953)
Hugo SUBTIL's avatar
Hugo SUBTIL committed
};

function deprecate(wrapped, message) {
  return function () {
    log('warn', message);
    return wrapped.apply(this, arguments);
  };
}

/***/ }),
/* 2 */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

module.exports = __webpack_require__(3)["default"];

/***/ }),
/* 3 */
/***/ ((module, exports, __webpack_require__) => {

/**
 * This is a function which returns an instance of
 * [request-promise](https://www.npmjs.com/package/request-promise) initialized with
 * defaults often used in connector development.
 *
 * ```js
 * // Showing defaults
 * req = requestFactory({
 *   cheerio: false,
 *   jar: true,
 *   json: true
 * })
 * ```
 *
 * Options :
 *
 * - `cheerio`:  will parse automatically the `response.body` in a cheerio instance
 *
 * ```javascript
 * req = requestFactory({ cheerio: true })
 * req('http://github.com', $ => {
 *   const repos = $('#repo_listing .repo')
 * })
 * ```
 *
 * - `jar`: is passed to `request` options. Remembers cookies for future use.
 * - `json`: will parse the `response.body` as JSON
 * - `resolveWithFullResponse`: The full response will be return in the promise. It is compatible
 *   with cheerio and json options.
 *
 * ```javascript
 * req = requestFactory({
 *    resolveWithFullResponse: true,
 *    cheerio: true
 * })
 * req('http://github.com', response => {
 *   console.log(response.statusCode)
 *   const $ = response.body
 *   const repos = $('#repo_listing .repo')
 * })
 * ```
 * - `debug`: will display request and responses details in error output. Possible values :
 *   true : display request and response in normal request-debug json format
 *   'json' : display request and response in full json format
 *   'simple' : display main information about each request and response
 *   ```
 *   GET -> http://books.toscrape.com/media/cache/26/0c/260c6ae16bce31c8f8c95daddd9f4a1c.jpg
 *   <- 200  Content-Length: 7095
 *   ```
 *   'full' : display comple information about each request and response
 *   ```
 *   GET -> http://quotes.toscrape.com/login
 *
 *   BEGIN HEADERS
 *   host: quotes.toscrape.com
 *   END HEADERS
 *
 *   <- 200  Content-Length: 1869
 *
 *   BEGIN HEADERS
 *   server: nginx/1.12.1
 *   ...
 *   END HEADERS
 *
 *   BEGIN BODY
 *   <html>....
 *   END BODY
 *   ```
 *
 * You can find the full list of available options in [request-promise](https://github.com/request/request-promise) and [request](https://github.com/request/request) documentations.
 *
 * @module requestFactory
 */
let request = __webpack_require__(4);

const requestdebug = __webpack_require__(254); // Quickly found more UserAgent here
// https://www.whatismybrowser.com/guides/the-latest-user-agent/


const AGENTS_LIST = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11.1; rv:84.0) Gecko/20100101 Firefox/84.0', 'Mozilla/5.0 (X11; Linux i686; rv:84.0) Gecko/20100101 Firefox/84.0', 'Mozilla/5.0 (Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0', 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:84.0) Gecko/20100101 Firefox/84.0', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75'];
const DEFAULT_USER_AGENT = AGENTS_LIST[Math.floor(Math.random() * AGENTS_LIST.length)];
exports = module.exports = {
  default: requestFactory,
  mergeDefaultOptions,
  transformWithCheerio,
  getRequestOptions,
  DEFAULT_USER_AGENT
};

function requestFactory({
  debug,
  ...options
} = {
  debug: false
}) {
  const logFn = setDebugFunction(debug);
  debug && requestdebug(request, logFn);
  return request.defaults(getRequestOptions(mergeDefaultOptions(options)));
}

function setDebugFunction(debug) {
  /* eslint no-console: off */
  if (debug === 'simple') {
    return (type, data) => console.error(requestToStrings(type, data).oneline);
  } else if (debug === 'json') {
    return (type, data) => console.error(JSON.stringify({
      type,
      data
    }));
  } else if (debug === 'full') {
    return (type, data) => {
      const {
        oneline,
        headers,
        body
      } = requestToStrings(type, data);
      console.error(`${oneline}

BEGIN HEADERS
${headers}
END HEADERS

` + (body ? `BEGIN BODY
${body}
END BODY

` : ''));
    };
  } else if (typeof debug === 'function') {
    return (type, data, resp) => debug({
      strings: requestToStrings(type, data),
      type,
      data,
      resp
    });
  }
Loading
Loading full blame...