1 | "use strict";
|
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4 | return new (P || (P = Promise))(function (resolve, reject) {
|
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9 | });
|
10 | };
|
11 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
12 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
13 | };
|
14 | Object.defineProperty(exports, "__esModule", { value: true });
|
15 | exports.makeDefaultOptions = exports.optionsDefault = exports.defaultPath = void 0;
|
16 | const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
17 | const pick_1 = __importDefault(require("lodash/pick"));
|
18 | const sanitize_user_for_client_1 = require("./helpers/sanitize-user-for-client");
|
19 | exports.defaultPath = 'authManagement';
|
20 | exports.optionsDefault = {
|
21 | service: '/users',
|
22 |
|
23 | notifier: (type, user, notifierOptions) => __awaiter(void 0, void 0, void 0, function* () { }),
|
24 | longTokenLen: 15,
|
25 | shortTokenLen: 6,
|
26 | shortTokenDigits: true,
|
27 | resetDelay: 1000 * 60 * 60 * 2,
|
28 | delay: 1000 * 60 * 60 * 24 * 5,
|
29 | resetAttempts: 0,
|
30 | reuseResetToken: false,
|
31 | identifyUserProps: ['email'],
|
32 | sanitizeUserForClient: sanitize_user_for_client_1.sanitizeUserForClient,
|
33 | skipIsVerifiedCheck: false,
|
34 | passwordField: 'password',
|
35 | skipPasswordHash: false,
|
36 | passParams: undefined
|
37 | };
|
38 | function makeDefaultOptions(keys) {
|
39 | const options = (0, cloneDeep_1.default)(exports.optionsDefault);
|
40 | if (!keys) {
|
41 | return options;
|
42 | }
|
43 |
|
44 | return (0, pick_1.default)(options, keys);
|
45 | }
|
46 | exports.makeDefaultOptions = makeDefaultOptions;
|