tough-cookie 5.0.0-rc.2 → 5.0.0-rc.3
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/cookie/canonicalDomain.js +1 -2
- package/dist/cookie/cookie.js +1 -2
- package/dist/cookie/cookieCompare.js +1 -29
- package/dist/cookie/cookieJar.js +44 -34
- package/dist/cookie/defaultPath.js +1 -2
- package/dist/cookie/domainMatch.js +1 -2
- package/dist/cookie/formatDate.js +1 -28
- package/dist/cookie/index.js +3 -4
- package/dist/cookie/parseDate.js +1 -2
- package/dist/cookie/permutePath.js +1 -27
- package/dist/getPublicSuffix.js +1 -2
- package/dist/pathMatch.js +1 -2
- package/dist/permuteDomain.js +1 -2
- package/dist/utils.js +3 -3
- package/dist/validators.js +8 -8
- package/dist/version.js +1 -1
- package/package.json +18 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.canonicalDomain =
|
|
3
|
+
exports.canonicalDomain = canonicalDomain;
|
|
4
4
|
const punycode_js_1 = require("punycode/punycode.js");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
6
|
/**
|
|
@@ -49,4 +49,3 @@ function canonicalDomain(domainName) {
|
|
|
49
49
|
}
|
|
50
50
|
return _str.toLowerCase();
|
|
51
51
|
}
|
|
52
|
-
exports.canonicalDomain = canonicalDomain;
|
package/dist/cookie/cookie.js
CHANGED
|
@@ -86,7 +86,6 @@ function trimTerminator(str) {
|
|
|
86
86
|
}
|
|
87
87
|
function parseCookiePair(cookiePair, looseMode) {
|
|
88
88
|
cookiePair = trimTerminator(cookiePair);
|
|
89
|
-
validators.validate(validators.isString(cookiePair), cookiePair);
|
|
90
89
|
let firstEq = cookiePair.indexOf('=');
|
|
91
90
|
if (looseMode) {
|
|
92
91
|
if (firstEq === 0) {
|
|
@@ -390,7 +389,7 @@ class Cookie {
|
|
|
390
389
|
// used to break creation ties in cookieCompare():
|
|
391
390
|
Object.defineProperty(this, 'creationIndex', {
|
|
392
391
|
configurable: false,
|
|
393
|
-
enumerable: false,
|
|
392
|
+
enumerable: false, // important for assert.deepEqual checks
|
|
394
393
|
writable: true,
|
|
395
394
|
value: ++Cookie.cookiesCreated,
|
|
396
395
|
});
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.cookieCompare =
|
|
27
|
-
const utils_1 = require("../utils");
|
|
28
|
-
const validators = __importStar(require("../validators"));
|
|
3
|
+
exports.cookieCompare = cookieCompare;
|
|
29
4
|
/**
|
|
30
5
|
* The maximum timestamp a cookie, in milliseconds. The value is (2^31 - 1) seconds since the Unix
|
|
31
6
|
* epoch, corresponding to 2038-01-19.
|
|
@@ -88,8 +63,6 @@ const MAX_TIME = 2147483647000;
|
|
|
88
63
|
* @public
|
|
89
64
|
*/
|
|
90
65
|
function cookieCompare(a, b) {
|
|
91
|
-
validators.validate(validators.isObject(a), (0, utils_1.safeToString)(a));
|
|
92
|
-
validators.validate(validators.isObject(b), (0, utils_1.safeToString)(b));
|
|
93
66
|
let cmp;
|
|
94
67
|
// descending for length: b CMP a
|
|
95
68
|
const aPathLen = a.path ? a.path.length : 0;
|
|
@@ -109,4 +82,3 @@ function cookieCompare(a, b) {
|
|
|
109
82
|
cmp = (a.creationIndex || 0) - (b.creationIndex || 0);
|
|
110
83
|
return cmp;
|
|
111
84
|
}
|
|
112
|
-
exports.cookieCompare = cookieCompare;
|
package/dist/cookie/cookieJar.js
CHANGED
|
@@ -73,7 +73,6 @@ function getCookieContext(url) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
function checkSameSiteContext(value) {
|
|
76
|
-
validators.validate(validators.isNonEmptyString(value), value);
|
|
77
76
|
const context = String(value).toLowerCase();
|
|
78
77
|
if (context === 'none' || context === 'lax' || context === 'strict') {
|
|
79
78
|
return context;
|
|
@@ -90,7 +89,6 @@ function checkSameSiteContext(value) {
|
|
|
90
89
|
* @returns boolean
|
|
91
90
|
*/
|
|
92
91
|
function isSecurePrefixConditionMet(cookie) {
|
|
93
|
-
validators.validate(validators.isObject(cookie), (0, utils_1.safeToString)(cookie));
|
|
94
92
|
const startsWithSecurePrefix = typeof cookie.key === 'string' && cookie.key.startsWith('__Secure-');
|
|
95
93
|
return !startsWithSecurePrefix || cookie.secure;
|
|
96
94
|
}
|
|
@@ -106,7 +104,6 @@ function isSecurePrefixConditionMet(cookie) {
|
|
|
106
104
|
* @returns boolean
|
|
107
105
|
*/
|
|
108
106
|
function isHostPrefixConditionMet(cookie) {
|
|
109
|
-
validators.validate(validators.isObject(cookie));
|
|
110
107
|
const startsWithHostPrefix = typeof cookie.key === 'string' && cookie.key.startsWith('__Host-');
|
|
111
108
|
return (!startsWithHostPrefix ||
|
|
112
109
|
Boolean(cookie.secure &&
|
|
@@ -160,12 +157,15 @@ class CookieJar {
|
|
|
160
157
|
}
|
|
161
158
|
let syncErr = null;
|
|
162
159
|
let syncResult = undefined;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
try {
|
|
161
|
+
fn.call(this, (error, result) => {
|
|
162
|
+
syncErr = error;
|
|
163
|
+
syncResult = result;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
syncErr = err;
|
|
168
|
+
}
|
|
169
169
|
if (syncErr)
|
|
170
170
|
throw syncErr;
|
|
171
171
|
return syncResult;
|
|
@@ -180,26 +180,32 @@ class CookieJar {
|
|
|
180
180
|
}
|
|
181
181
|
const promiseCallback = (0, utils_1.createPromiseCallback)(callback);
|
|
182
182
|
const cb = promiseCallback.callback;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
options
|
|
183
|
+
let context;
|
|
184
|
+
try {
|
|
185
|
+
if (typeof url === 'string') {
|
|
186
|
+
validators.validate(validators.isNonEmptyString(url), callback, (0, utils_1.safeToString)(options));
|
|
187
|
+
}
|
|
188
|
+
context = getCookieContext(url);
|
|
189
|
+
if (typeof url === 'function') {
|
|
190
|
+
return promiseCallback.reject(new Error('No URL was specified'));
|
|
191
|
+
}
|
|
192
|
+
if (typeof options === 'function') {
|
|
193
|
+
options = defaultSetCookieOptions;
|
|
194
|
+
}
|
|
195
|
+
validators.validate(typeof cb === 'function', cb);
|
|
196
|
+
if (!validators.isNonEmptyString(cookie) &&
|
|
197
|
+
!validators.isObject(cookie) &&
|
|
198
|
+
cookie instanceof String &&
|
|
199
|
+
cookie.length == 0) {
|
|
200
|
+
return promiseCallback.resolve(undefined);
|
|
201
|
+
}
|
|
193
202
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
!validators.isObject(cookie) &&
|
|
197
|
-
cookie instanceof String &&
|
|
198
|
-
cookie.length == 0) {
|
|
199
|
-
return promiseCallback.resolve(undefined);
|
|
203
|
+
catch (err) {
|
|
204
|
+
return promiseCallback.reject(err);
|
|
200
205
|
}
|
|
201
206
|
const host = (0, canonicalDomain_1.canonicalDomain)(context.hostname) ?? null;
|
|
202
207
|
const loose = options?.loose || this.enableLooseMode;
|
|
208
|
+
let err;
|
|
203
209
|
let sameSiteContext = null;
|
|
204
210
|
if (options?.sameSiteContext) {
|
|
205
211
|
sameSiteContext = checkSameSiteContext(options.sameSiteContext);
|
|
@@ -432,12 +438,18 @@ class CookieJar {
|
|
|
432
438
|
}
|
|
433
439
|
const promiseCallback = (0, utils_1.createPromiseCallback)(callback);
|
|
434
440
|
const cb = promiseCallback.callback;
|
|
435
|
-
|
|
436
|
-
|
|
441
|
+
let context;
|
|
442
|
+
try {
|
|
443
|
+
if (typeof url === 'string') {
|
|
444
|
+
validators.validate(validators.isNonEmptyString(url), cb, url);
|
|
445
|
+
}
|
|
446
|
+
context = getCookieContext(url);
|
|
447
|
+
validators.validate(validators.isObject(options), cb, (0, utils_1.safeToString)(options));
|
|
448
|
+
validators.validate(typeof cb === 'function', cb);
|
|
449
|
+
}
|
|
450
|
+
catch (parameterError) {
|
|
451
|
+
return promiseCallback.reject(parameterError);
|
|
437
452
|
}
|
|
438
|
-
const context = getCookieContext(url);
|
|
439
|
-
validators.validate(validators.isObject(options), cb, (0, utils_1.safeToString)(options));
|
|
440
|
-
validators.validate(typeof cb === 'function', cb);
|
|
441
453
|
const host = (0, canonicalDomain_1.canonicalDomain)(context.hostname);
|
|
442
454
|
const path = context.pathname || '/';
|
|
443
455
|
const secure = context.protocol &&
|
|
@@ -526,7 +538,7 @@ class CookieJar {
|
|
|
526
538
|
}
|
|
527
539
|
cookies = cookies.filter(matchingCookie);
|
|
528
540
|
// sorting of S5.4 part 2
|
|
529
|
-
if (
|
|
541
|
+
if ('sort' in options && options.sort !== false) {
|
|
530
542
|
cookies = cookies.sort(cookieCompare_1.cookieCompare);
|
|
531
543
|
}
|
|
532
544
|
// S5.4 part 3
|
|
@@ -632,8 +644,6 @@ class CookieJar {
|
|
|
632
644
|
*/
|
|
633
645
|
serialize(callback) {
|
|
634
646
|
const promiseCallback = (0, utils_1.createPromiseCallback)(callback);
|
|
635
|
-
const cb = promiseCallback.callback;
|
|
636
|
-
validators.validate(typeof cb === 'function', cb);
|
|
637
647
|
let type = this.store.constructor.name;
|
|
638
648
|
if (validators.isObject(type)) {
|
|
639
649
|
type = null;
|
|
@@ -834,7 +844,7 @@ class CookieJar {
|
|
|
834
844
|
removeErrors.push(removeErr);
|
|
835
845
|
}
|
|
836
846
|
completedCount++;
|
|
837
|
-
if (completedCount === cookies
|
|
847
|
+
if (completedCount === cookies.length) {
|
|
838
848
|
if (removeErrors[0])
|
|
839
849
|
cb(removeErrors[0]);
|
|
840
850
|
else
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultPath =
|
|
3
|
+
exports.defaultPath = defaultPath;
|
|
4
4
|
/**
|
|
5
5
|
* Given a current request/response path, gives the path appropriate for storing
|
|
6
6
|
* in a cookie. This is basically the "directory" of a "file" in the path, but
|
|
@@ -58,4 +58,3 @@ function defaultPath(path) {
|
|
|
58
58
|
// but not including, the right-most %x2F ("/")."
|
|
59
59
|
return path.slice(0, rightSlash);
|
|
60
60
|
}
|
|
61
|
-
exports.defaultPath = defaultPath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.domainMatch =
|
|
3
|
+
exports.domainMatch = domainMatch;
|
|
4
4
|
const canonicalDomain_1 = require("./canonicalDomain");
|
|
5
5
|
// Dumped from ip-regex@4.0.0, with the following changes:
|
|
6
6
|
// * all capturing groups converted to non-capturing -- "(?:)"
|
|
@@ -92,4 +92,3 @@ function domainMatch(domain, cookieDomain, canonicalize) {
|
|
|
92
92
|
/* " * The string is a host name (i.e., not an IP address)." */
|
|
93
93
|
return !IP_REGEX_LOWERCASE.test(_str);
|
|
94
94
|
}
|
|
95
|
-
exports.domainMatch = domainMatch;
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.formatDate =
|
|
27
|
-
const validators = __importStar(require("../validators"));
|
|
28
|
-
const utils_1 = require("../utils");
|
|
3
|
+
exports.formatDate = formatDate;
|
|
29
4
|
/**
|
|
30
5
|
* Format a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date | Date} into
|
|
31
6
|
* the {@link https://www.rfc-editor.org/rfc/rfc2616#section-3.3.1 | preferred Internet standard format}
|
|
@@ -41,7 +16,5 @@ const utils_1 = require("../utils");
|
|
|
41
16
|
* @public
|
|
42
17
|
*/
|
|
43
18
|
function formatDate(date) {
|
|
44
|
-
validators.validate(validators.isDate(date), (0, utils_1.safeToString)(date));
|
|
45
19
|
return date.toUTCString();
|
|
46
20
|
}
|
|
47
|
-
exports.formatDate = formatDate;
|
package/dist/cookie/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.permutePath = exports.parseDate = exports.formatDate = exports.domainMatch = exports.defaultPath = exports.CookieJar = exports.cookieCompare = exports.Cookie = exports.PrefixSecurityEnum = exports.canonicalDomain = exports.version = exports.ParameterError = exports.Store = exports.getPublicSuffix = exports.permuteDomain = exports.pathMatch = exports.MemoryCookieStore = void 0;
|
|
4
|
+
exports.parse = parse;
|
|
5
|
+
exports.fromJSON = fromJSON;
|
|
4
6
|
var memstore_1 = require("../memstore");
|
|
5
7
|
Object.defineProperty(exports, "MemoryCookieStore", { enumerable: true, get: function () { return memstore_1.MemoryCookieStore; } });
|
|
6
8
|
var pathMatch_1 = require("../pathMatch");
|
|
@@ -15,7 +17,6 @@ var validators_1 = require("../validators");
|
|
|
15
17
|
Object.defineProperty(exports, "ParameterError", { enumerable: true, get: function () { return validators_1.ParameterError; } });
|
|
16
18
|
var version_1 = require("../version");
|
|
17
19
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
|
|
18
|
-
var utils_1 = require("../utils");
|
|
19
20
|
var canonicalDomain_1 = require("./canonicalDomain");
|
|
20
21
|
Object.defineProperty(exports, "canonicalDomain", { enumerable: true, get: function () { return canonicalDomain_1.canonicalDomain; } });
|
|
21
22
|
var constants_1 = require("./constants");
|
|
@@ -44,7 +45,6 @@ const cookie_2 = require("./cookie");
|
|
|
44
45
|
function parse(str, options) {
|
|
45
46
|
return cookie_2.Cookie.parse(str, options);
|
|
46
47
|
}
|
|
47
|
-
exports.parse = parse;
|
|
48
48
|
/**
|
|
49
49
|
* {@inheritDoc Cookie.fromJSON}
|
|
50
50
|
* @public
|
|
@@ -52,4 +52,3 @@ exports.parse = parse;
|
|
|
52
52
|
function fromJSON(str) {
|
|
53
53
|
return cookie_2.Cookie.fromJSON(str);
|
|
54
54
|
}
|
|
55
|
-
exports.fromJSON = fromJSON;
|
package/dist/cookie/parseDate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// date-time parsing constants (RFC6265 S5.1.1)
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.parseDate =
|
|
4
|
+
exports.parseDate = parseDate;
|
|
5
5
|
// eslint-disable-next-line no-control-regex
|
|
6
6
|
const DATE_DELIM = /[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/;
|
|
7
7
|
const MONTH_TO_NUM = {
|
|
@@ -321,4 +321,3 @@ function parseDate(cookieDate) {
|
|
|
321
321
|
}
|
|
322
322
|
return new Date(Date.UTC(year, month, dayOfMonth, hour, minute, second));
|
|
323
323
|
}
|
|
324
|
-
exports.parseDate = parseDate;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.permutePath =
|
|
27
|
-
const validators = __importStar(require("../validators"));
|
|
3
|
+
exports.permutePath = permutePath;
|
|
28
4
|
/**
|
|
29
5
|
* Generates the permutation of all possible values that {@link pathMatch} the `path` parameter.
|
|
30
6
|
* The array is in longest-to-shortest order. Useful when building custom {@link Store} implementations.
|
|
@@ -39,7 +15,6 @@ const validators = __importStar(require("../validators"));
|
|
|
39
15
|
* @public
|
|
40
16
|
*/
|
|
41
17
|
function permutePath(path) {
|
|
42
|
-
validators.validate(validators.isString(path));
|
|
43
18
|
if (path === '/') {
|
|
44
19
|
return ['/'];
|
|
45
20
|
}
|
|
@@ -55,4 +30,3 @@ function permutePath(path) {
|
|
|
55
30
|
permutations.push('/');
|
|
56
31
|
return permutations;
|
|
57
32
|
}
|
|
58
|
-
exports.permutePath = permutePath;
|
package/dist/getPublicSuffix.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPublicSuffix =
|
|
3
|
+
exports.getPublicSuffix = getPublicSuffix;
|
|
4
4
|
const tldts_1 = require("tldts");
|
|
5
5
|
// RFC 6761
|
|
6
6
|
const SPECIAL_USE_DOMAINS = ['local', 'example', 'invalid', 'localhost', 'test'];
|
|
@@ -69,4 +69,3 @@ function getPublicSuffix(domain, options = {}) {
|
|
|
69
69
|
if (publicSuffix)
|
|
70
70
|
return publicSuffix;
|
|
71
71
|
}
|
|
72
|
-
exports.getPublicSuffix = getPublicSuffix;
|
package/dist/pathMatch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pathMatch =
|
|
3
|
+
exports.pathMatch = pathMatch;
|
|
4
4
|
/**
|
|
5
5
|
* Answers "does the request-path path-match a given cookie-path?" as per {@link https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.4 | RFC6265 Section 5.1.4}.
|
|
6
6
|
* This is essentially a prefix-match where cookiePath is a prefix of reqPath.
|
|
@@ -39,4 +39,3 @@ function pathMatch(reqPath, cookiePath) {
|
|
|
39
39
|
}
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
|
-
exports.pathMatch = pathMatch;
|
package/dist/permuteDomain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.permuteDomain =
|
|
3
|
+
exports.permuteDomain = permuteDomain;
|
|
4
4
|
const getPublicSuffix_1 = require("./getPublicSuffix");
|
|
5
5
|
/**
|
|
6
6
|
* Generates the permutation of all possible values that {@link domainMatch} the given `domain` parameter. The
|
|
@@ -42,4 +42,3 @@ function permuteDomain(domain, allowSpecialUseDomain) {
|
|
|
42
42
|
}
|
|
43
43
|
return permutations;
|
|
44
44
|
}
|
|
45
|
-
exports.permuteDomain = permuteDomain;
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.safeToString = exports.objectToString = void 0;
|
|
4
|
+
exports.createPromiseCallback = createPromiseCallback;
|
|
5
|
+
exports.inOperator = inOperator;
|
|
4
6
|
/** Wrapped `Object.prototype.toString`, so that you don't need to remember to use `.call()`. */
|
|
5
7
|
const objectToString = (obj) => Object.prototype.toString.call(obj);
|
|
6
8
|
exports.objectToString = objectToString;
|
|
@@ -85,8 +87,6 @@ function createPromiseCallback(cb) {
|
|
|
85
87
|
},
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
|
-
exports.createPromiseCallback = createPromiseCallback;
|
|
89
90
|
function inOperator(k, o) {
|
|
90
91
|
return k in o;
|
|
91
92
|
}
|
|
92
|
-
exports.inOperator = inOperator;
|
package/dist/validators.js
CHANGED
|
@@ -27,39 +27,40 @@ SOFTWARE.
|
|
|
27
27
|
|
|
28
28
|
************************************************************************************ */
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.ParameterError =
|
|
30
|
+
exports.ParameterError = void 0;
|
|
31
|
+
exports.isNonEmptyString = isNonEmptyString;
|
|
32
|
+
exports.isDate = isDate;
|
|
33
|
+
exports.isEmptyString = isEmptyString;
|
|
34
|
+
exports.isString = isString;
|
|
35
|
+
exports.isObject = isObject;
|
|
36
|
+
exports.isInteger = isInteger;
|
|
37
|
+
exports.validate = validate;
|
|
31
38
|
const utils_1 = require("./utils");
|
|
32
39
|
/* Validation functions copied from check-types package - https://www.npmjs.com/package/check-types */
|
|
33
40
|
/** Determines whether the argument is a non-empty string. */
|
|
34
41
|
function isNonEmptyString(data) {
|
|
35
42
|
return isString(data) && data !== '';
|
|
36
43
|
}
|
|
37
|
-
exports.isNonEmptyString = isNonEmptyString;
|
|
38
44
|
/** Determines whether the argument is a *valid* Date. */
|
|
39
45
|
function isDate(data) {
|
|
40
46
|
return data instanceof Date && isInteger(data.getTime());
|
|
41
47
|
}
|
|
42
|
-
exports.isDate = isDate;
|
|
43
48
|
/** Determines whether the argument is the empty string. */
|
|
44
49
|
function isEmptyString(data) {
|
|
45
50
|
return data === '' || (data instanceof String && data.toString() === '');
|
|
46
51
|
}
|
|
47
|
-
exports.isEmptyString = isEmptyString;
|
|
48
52
|
/** Determines whether the argument is a string. */
|
|
49
53
|
function isString(data) {
|
|
50
54
|
return typeof data === 'string' || data instanceof String;
|
|
51
55
|
}
|
|
52
|
-
exports.isString = isString;
|
|
53
56
|
/** Determines whether the string representation of the argument is "[object Object]". */
|
|
54
57
|
function isObject(data) {
|
|
55
58
|
return (0, utils_1.objectToString)(data) === '[object Object]';
|
|
56
59
|
}
|
|
57
|
-
exports.isObject = isObject;
|
|
58
60
|
/** Determines whether the argument is an integer. */
|
|
59
61
|
function isInteger(data) {
|
|
60
62
|
return typeof data === 'number' && data % 1 === 0;
|
|
61
63
|
}
|
|
62
|
-
exports.isInteger = isInteger;
|
|
63
64
|
/* -- End validation functions -- */
|
|
64
65
|
/**
|
|
65
66
|
* When the first argument is false, an error is created with the given message. If a callback is
|
|
@@ -80,7 +81,6 @@ function validate(bool, cbOrMessage, message) {
|
|
|
80
81
|
else
|
|
81
82
|
throw err;
|
|
82
83
|
}
|
|
83
|
-
exports.validate = validate;
|
|
84
84
|
/**
|
|
85
85
|
* Represents a validation error.
|
|
86
86
|
* @public
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -52,6 +52,14 @@
|
|
|
52
52
|
{
|
|
53
53
|
"name": "Sam Thompson",
|
|
54
54
|
"website": "https://github.com/sambthompson"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "Colin Casey",
|
|
58
|
+
"website": "https://github.com/colincasey"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "Will Harney",
|
|
62
|
+
"website": "https://github.com/wjhsf"
|
|
55
63
|
}
|
|
56
64
|
],
|
|
57
65
|
"license": "BSD-3-Clause",
|
|
@@ -67,7 +75,7 @@
|
|
|
67
75
|
"RFC6265",
|
|
68
76
|
"RFC2965"
|
|
69
77
|
],
|
|
70
|
-
"version": "5.0.0-rc.
|
|
78
|
+
"version": "5.0.0-rc.3",
|
|
71
79
|
"homepage": "https://github.com/salesforce/tough-cookie",
|
|
72
80
|
"repository": {
|
|
73
81
|
"type": "git",
|
|
@@ -104,9 +112,9 @@
|
|
|
104
112
|
"node": ">=16"
|
|
105
113
|
},
|
|
106
114
|
"devDependencies": {
|
|
107
|
-
"@eslint/js": "^
|
|
108
|
-
"@microsoft/api-documenter": "^7.
|
|
109
|
-
"@microsoft/api-extractor": "^7.
|
|
115
|
+
"@eslint/js": "^9.5.0",
|
|
116
|
+
"@microsoft/api-documenter": "^7.25.3",
|
|
117
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
110
118
|
"@types/jest": "^29.5.12",
|
|
111
119
|
"@types/node": "^14.18.63",
|
|
112
120
|
"@types/punycode": "^2.1.4",
|
|
@@ -116,18 +124,18 @@
|
|
|
116
124
|
"eslint-config-prettier": "^9.1.0",
|
|
117
125
|
"eslint-plugin-prettier": "^5.1.3",
|
|
118
126
|
"genversion": "^3.2.0",
|
|
119
|
-
"globals": "^
|
|
127
|
+
"globals": "^15.6.0",
|
|
120
128
|
"jest": "^29.7.0",
|
|
121
|
-
"prettier": "^3.2
|
|
122
|
-
"ts-jest": "^29.1.
|
|
129
|
+
"prettier": "^3.3.2",
|
|
130
|
+
"ts-jest": "^29.1.5",
|
|
123
131
|
"ts-node": "^10.9.2",
|
|
124
|
-
"typescript": "
|
|
125
|
-
"typescript-eslint": "^7.
|
|
132
|
+
"typescript": "5.5.2",
|
|
133
|
+
"typescript-eslint": "^7.13.1",
|
|
126
134
|
"vows": "^0.8.3"
|
|
127
135
|
},
|
|
128
136
|
"dependencies": {
|
|
129
137
|
"punycode": "^2.3.1",
|
|
130
|
-
"tldts": "^6.1.
|
|
138
|
+
"tldts": "^6.1.28",
|
|
131
139
|
"url-parse": "^1.5.10"
|
|
132
140
|
}
|
|
133
141
|
}
|