UNPKG

2.23 kBJavaScriptView Raw
1"use strict";
2var __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};
11var __importDefault = (this && this.__importDefault) || function (mod) {
12 return (mod && mod.__esModule) ? mod : { "default": mod };
13};
14Object.defineProperty(exports, "__esModule", { value: true });
15exports.makeDefaultOptions = exports.optionsDefault = exports.defaultPath = void 0;
16const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
17const pick_1 = __importDefault(require("lodash/pick"));
18const sanitize_user_for_client_1 = require("./helpers/sanitize-user-for-client");
19exports.defaultPath = 'authManagement';
20exports.optionsDefault = {
21 service: '/users',
22 // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
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};
38function makeDefaultOptions(keys) {
39 const options = (0, cloneDeep_1.default)(exports.optionsDefault);
40 if (!keys) {
41 return options;
42 }
43 // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
44 return (0, pick_1.default)(options, keys);
45}
46exports.makeDefaultOptions = makeDefaultOptions;