@mjhls/mjh-framework 1.0.518 → 1.0.519

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/Auth.js CHANGED
@@ -14,6 +14,7 @@ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-037
14
14
  import './_set-species-6f64f1c1.js';
15
15
  import { Col, Form, Button, Spinner } from 'react-bootstrap';
16
16
  import { u as util } from './util-7700fc59.js';
17
+ import { s as serialize_1, p as parse_1 } from './index-db3bb315.js';
17
18
  import useSWR from 'swr';
18
19
  import Local from 'passport-local';
19
20
  import mysql from 'mysql';
@@ -1201,207 +1202,6 @@ var SignupForm$1 = function SignupForm(props) {
1201
1202
  );
1202
1203
  };
1203
1204
 
1204
- /*!
1205
- * cookie
1206
- * Copyright(c) 2012-2014 Roman Shtylman
1207
- * Copyright(c) 2015 Douglas Christopher Wilson
1208
- * MIT Licensed
1209
- */
1210
-
1211
- /**
1212
- * Module exports.
1213
- * @public
1214
- */
1215
-
1216
- var parse_1 = parse;
1217
- var serialize_1 = serialize;
1218
-
1219
- /**
1220
- * Module variables.
1221
- * @private
1222
- */
1223
-
1224
- var decode = decodeURIComponent;
1225
- var encode = encodeURIComponent;
1226
- var pairSplitRegExp = /; */;
1227
-
1228
- /**
1229
- * RegExp to match field-content in RFC 7230 sec 3.2
1230
- *
1231
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
1232
- * field-vchar = VCHAR / obs-text
1233
- * obs-text = %x80-FF
1234
- */
1235
-
1236
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
1237
-
1238
- /**
1239
- * Parse a cookie header.
1240
- *
1241
- * Parse the given cookie header string into an object
1242
- * The object has the various cookies as keys(names) => values
1243
- *
1244
- * @param {string} str
1245
- * @param {object} [options]
1246
- * @return {object}
1247
- * @public
1248
- */
1249
-
1250
- function parse(str, options) {
1251
- if (typeof str !== 'string') {
1252
- throw new TypeError('argument str must be a string');
1253
- }
1254
-
1255
- var obj = {};
1256
- var opt = options || {};
1257
- var pairs = str.split(pairSplitRegExp);
1258
- var dec = opt.decode || decode;
1259
-
1260
- for (var i = 0; i < pairs.length; i++) {
1261
- var pair = pairs[i];
1262
- var eq_idx = pair.indexOf('=');
1263
-
1264
- // skip things that don't look like key=value
1265
- if (eq_idx < 0) {
1266
- continue;
1267
- }
1268
-
1269
- var key = pair.substr(0, eq_idx).trim();
1270
- var val = pair.substr(++eq_idx, pair.length).trim();
1271
-
1272
- // quoted values
1273
- if ('"' == val[0]) {
1274
- val = val.slice(1, -1);
1275
- }
1276
-
1277
- // only assign once
1278
- if (undefined == obj[key]) {
1279
- obj[key] = tryDecode(val, dec);
1280
- }
1281
- }
1282
-
1283
- return obj;
1284
- }
1285
-
1286
- /**
1287
- * Serialize data into a cookie header.
1288
- *
1289
- * Serialize the a name value pair into a cookie string suitable for
1290
- * http headers. An optional options object specified cookie parameters.
1291
- *
1292
- * serialize('foo', 'bar', { httpOnly: true })
1293
- * => "foo=bar; httpOnly"
1294
- *
1295
- * @param {string} name
1296
- * @param {string} val
1297
- * @param {object} [options]
1298
- * @return {string}
1299
- * @public
1300
- */
1301
-
1302
- function serialize(name, val, options) {
1303
- var opt = options || {};
1304
- var enc = opt.encode || encode;
1305
-
1306
- if (typeof enc !== 'function') {
1307
- throw new TypeError('option encode is invalid');
1308
- }
1309
-
1310
- if (!fieldContentRegExp.test(name)) {
1311
- throw new TypeError('argument name is invalid');
1312
- }
1313
-
1314
- var value = enc(val);
1315
-
1316
- if (value && !fieldContentRegExp.test(value)) {
1317
- throw new TypeError('argument val is invalid');
1318
- }
1319
-
1320
- var str = name + '=' + value;
1321
-
1322
- if (null != opt.maxAge) {
1323
- var maxAge = opt.maxAge - 0;
1324
-
1325
- if (isNaN(maxAge) || !isFinite(maxAge)) {
1326
- throw new TypeError('option maxAge is invalid')
1327
- }
1328
-
1329
- str += '; Max-Age=' + Math.floor(maxAge);
1330
- }
1331
-
1332
- if (opt.domain) {
1333
- if (!fieldContentRegExp.test(opt.domain)) {
1334
- throw new TypeError('option domain is invalid');
1335
- }
1336
-
1337
- str += '; Domain=' + opt.domain;
1338
- }
1339
-
1340
- if (opt.path) {
1341
- if (!fieldContentRegExp.test(opt.path)) {
1342
- throw new TypeError('option path is invalid');
1343
- }
1344
-
1345
- str += '; Path=' + opt.path;
1346
- }
1347
-
1348
- if (opt.expires) {
1349
- if (typeof opt.expires.toUTCString !== 'function') {
1350
- throw new TypeError('option expires is invalid');
1351
- }
1352
-
1353
- str += '; Expires=' + opt.expires.toUTCString();
1354
- }
1355
-
1356
- if (opt.httpOnly) {
1357
- str += '; HttpOnly';
1358
- }
1359
-
1360
- if (opt.secure) {
1361
- str += '; Secure';
1362
- }
1363
-
1364
- if (opt.sameSite) {
1365
- var sameSite = typeof opt.sameSite === 'string'
1366
- ? opt.sameSite.toLowerCase() : opt.sameSite;
1367
-
1368
- switch (sameSite) {
1369
- case true:
1370
- str += '; SameSite=Strict';
1371
- break;
1372
- case 'lax':
1373
- str += '; SameSite=Lax';
1374
- break;
1375
- case 'strict':
1376
- str += '; SameSite=Strict';
1377
- break;
1378
- case 'none':
1379
- str += '; SameSite=None';
1380
- break;
1381
- default:
1382
- throw new TypeError('option sameSite is invalid');
1383
- }
1384
- }
1385
-
1386
- return str;
1387
- }
1388
-
1389
- /**
1390
- * Try decoding a string using a decoding function.
1391
- *
1392
- * @param {string} str
1393
- * @param {function} decode
1394
- * @private
1395
- */
1396
-
1397
- function tryDecode(str, decode) {
1398
- try {
1399
- return decode(str);
1400
- } catch (e) {
1401
- return str;
1402
- }
1403
- }
1404
-
1405
1205
  var TOKEN_NAME = 'token';
1406
1206
  var MAX_AGE = 60 * 60 * 8; // 8 hours
1407
1207