nlcurl 0.12.2 → 0.13.0
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/README.md +4 -15
- package/dist/cookies/psl-data.d.ts +2 -2
- package/dist/cookies/psl-data.d.ts.map +1 -1
- package/dist/cookies/psl-data.js +5 -2
- package/dist/cookies/psl-data.js.map +1 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/cache/groups.d.ts +0 -75
- package/dist/cache/groups.d.ts.map +0 -1
- package/dist/cache/groups.js +0 -118
- package/dist/cache/groups.js.map +0 -1
- package/dist/cache/no-vary-search.d.ts +0 -33
- package/dist/cache/no-vary-search.d.ts.map +0 -1
- package/dist/cache/no-vary-search.js +0 -148
- package/dist/cache/no-vary-search.js.map +0 -1
- package/dist/cache/range.d.ts +0 -120
- package/dist/cache/range.d.ts.map +0 -1
- package/dist/cache/range.js +0 -192
- package/dist/cache/range.js.map +0 -1
- package/dist/dns/dot-resolver.d.ts +0 -89
- package/dist/dns/dot-resolver.d.ts.map +0 -1
- package/dist/dns/dot-resolver.js +0 -166
- package/dist/dns/dot-resolver.js.map +0 -1
- package/dist/http/resumable-upload.d.ts +0 -76
- package/dist/http/resumable-upload.d.ts.map +0 -1
- package/dist/http/resumable-upload.js +0 -104
- package/dist/http/resumable-upload.js.map +0 -1
- package/dist/http/trailers.d.ts +0 -29
- package/dist/http/trailers.d.ts.map +0 -1
- package/dist/http/trailers.js +0 -57
- package/dist/http/trailers.js.map +0 -1
- package/dist/middleware/circuit-breaker.d.ts +0 -44
- package/dist/middleware/circuit-breaker.d.ts.map +0 -1
- package/dist/middleware/circuit-breaker.js +0 -96
- package/dist/middleware/circuit-breaker.js.map +0 -1
- package/dist/tls/ct.d.ts +0 -78
- package/dist/tls/ct.d.ts.map +0 -1
- package/dist/tls/ct.js +0 -175
- package/dist/tls/ct.js.map +0 -1
- package/dist/tls/early-data.d.ts +0 -45
- package/dist/tls/early-data.d.ts.map +0 -1
- package/dist/tls/early-data.js +0 -46
- package/dist/tls/early-data.js.map +0 -1
- package/dist/tls/ocsp.d.ts +0 -55
- package/dist/tls/ocsp.d.ts.map +0 -1
- package/dist/tls/ocsp.js +0 -131
- package/dist/tls/ocsp.js.map +0 -1
- package/dist/utils/dictionary-transport.d.ts +0 -97
- package/dist/utils/dictionary-transport.d.ts.map +0 -1
- package/dist/utils/dictionary-transport.js +0 -171
- package/dist/utils/dictionary-transport.js.map +0 -1
- package/dist/utils/tcp-fast-open.d.ts +0 -30
- package/dist/utils/tcp-fast-open.d.ts.map +0 -1
- package/dist/utils/tcp-fast-open.js +0 -36
- package/dist/utils/tcp-fast-open.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE1I,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAuB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE5F,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAgE,MAAM,gBAAgB,CAAC;AAExI,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAQvF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","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@@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nlcurl",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"updated": "2026.
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"updated": "2026.04.04.1904",
|
|
5
5
|
"description": "Next-level HTTP client with native TLS fingerprint impersonation. Pure TypeScript, zero dependencies.",
|
|
6
6
|
"author": "devAlphaSystem",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"request"
|
|
56
56
|
],
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@types/node": "^25.5.
|
|
58
|
+
"@types/node": "^25.5.2",
|
|
59
59
|
"prettier": "^3.8.1",
|
|
60
60
|
"tsx": "^4.21.0",
|
|
61
61
|
"typescript": "^5.9.3"
|
package/dist/cache/groups.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a named group of cache keys for batch invalidation.
|
|
3
|
-
*/
|
|
4
|
-
export interface CacheGroup {
|
|
5
|
-
name: string;
|
|
6
|
-
keys: Set<string>;
|
|
7
|
-
lastInvalidated: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Parses a comma-separated Cache-Groups header into an array of group names.
|
|
11
|
-
*
|
|
12
|
-
* @param {string} header - The raw Cache-Groups header value.
|
|
13
|
-
* @returns {string[]} Parsed group names.
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseCacheGroups(header: string): string[];
|
|
16
|
-
/**
|
|
17
|
-
* Manages cache key groupings for targeted invalidation of related cache entries.
|
|
18
|
-
*
|
|
19
|
-
* @class
|
|
20
|
-
*/
|
|
21
|
-
export declare class CacheGroupStore {
|
|
22
|
-
private readonly groups;
|
|
23
|
-
/**
|
|
24
|
-
* Associates a cache key with one or more named groups.
|
|
25
|
-
*
|
|
26
|
-
* @param {string} cacheKey - The cache key to associate.
|
|
27
|
-
* @param {string[]} groupNames - The groups to add the key to.
|
|
28
|
-
*/
|
|
29
|
-
addToGroups(cacheKey: string, groupNames: string[]): void;
|
|
30
|
-
/**
|
|
31
|
-
* Removes a cache key from all groups.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} cacheKey - The cache key to remove.
|
|
34
|
-
*/
|
|
35
|
-
removeFromAll(cacheKey: string): void;
|
|
36
|
-
/**
|
|
37
|
-
* Returns the set of cache keys belonging to a specific group.
|
|
38
|
-
*
|
|
39
|
-
* @param {string} groupName - The group name.
|
|
40
|
-
* @returns {Set<string>} The cache keys in the group.
|
|
41
|
-
*/
|
|
42
|
-
getGroupKeys(groupName: string): Set<string>;
|
|
43
|
-
/**
|
|
44
|
-
* Invalidates a single group, clearing its keys and recording the timestamp.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} groupName - The group name to invalidate.
|
|
47
|
-
* @returns {string[]} The cache keys that were in the invalidated group.
|
|
48
|
-
*/
|
|
49
|
-
invalidate(groupName: string): string[];
|
|
50
|
-
/**
|
|
51
|
-
* Invalidates all groups, clearing their keys and recording the timestamp.
|
|
52
|
-
*
|
|
53
|
-
* @returns {string[]} All unique cache keys that were invalidated.
|
|
54
|
-
*/
|
|
55
|
-
invalidateAll(): string[];
|
|
56
|
-
/**
|
|
57
|
-
* Checks whether a cache key has been invalidated since a given timestamp.
|
|
58
|
-
*
|
|
59
|
-
* @param {string} cacheKey - The cache key to check.
|
|
60
|
-
* @param {number} storedAt - The timestamp when the entry was stored.
|
|
61
|
-
* @returns {boolean} `true` if the key was invalidated after `storedAt`.
|
|
62
|
-
*/
|
|
63
|
-
isInvalidatedSince(cacheKey: string, storedAt: number): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Returns the number of tracked groups.
|
|
66
|
-
*
|
|
67
|
-
* @returns {number} The group count.
|
|
68
|
-
*/
|
|
69
|
-
get size(): number;
|
|
70
|
-
/**
|
|
71
|
-
* Removes all groups and their key associations.
|
|
72
|
-
*/
|
|
73
|
-
clear(): void;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=groups.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/cache/groups.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAMzD;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IAExD;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAWzD;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMrC;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAI5C;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAUvC;;;;OAIG;IACH,aAAa,IAAI,MAAM,EAAE;IAYzB;;;;;;OAMG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAS/D;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
package/dist/cache/groups.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a comma-separated Cache-Groups header into an array of group names.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} header - The raw Cache-Groups header value.
|
|
5
|
-
* @returns {string[]} Parsed group names.
|
|
6
|
-
*/
|
|
7
|
-
export function parseCacheGroups(header) {
|
|
8
|
-
if (!header)
|
|
9
|
-
return [];
|
|
10
|
-
return header
|
|
11
|
-
.split(",")
|
|
12
|
-
.map((s) => s.trim().replace(/"/g, ""))
|
|
13
|
-
.filter(Boolean);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Manages cache key groupings for targeted invalidation of related cache entries.
|
|
17
|
-
*
|
|
18
|
-
* @class
|
|
19
|
-
*/
|
|
20
|
-
export class CacheGroupStore {
|
|
21
|
-
groups = new Map();
|
|
22
|
-
/**
|
|
23
|
-
* Associates a cache key with one or more named groups.
|
|
24
|
-
*
|
|
25
|
-
* @param {string} cacheKey - The cache key to associate.
|
|
26
|
-
* @param {string[]} groupNames - The groups to add the key to.
|
|
27
|
-
*/
|
|
28
|
-
addToGroups(cacheKey, groupNames) {
|
|
29
|
-
for (const name of groupNames) {
|
|
30
|
-
let group = this.groups.get(name);
|
|
31
|
-
if (!group) {
|
|
32
|
-
group = { name, keys: new Set(), lastInvalidated: 0 };
|
|
33
|
-
this.groups.set(name, group);
|
|
34
|
-
}
|
|
35
|
-
group.keys.add(cacheKey);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Removes a cache key from all groups.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} cacheKey - The cache key to remove.
|
|
42
|
-
*/
|
|
43
|
-
removeFromAll(cacheKey) {
|
|
44
|
-
for (const group of this.groups.values()) {
|
|
45
|
-
group.keys.delete(cacheKey);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Returns the set of cache keys belonging to a specific group.
|
|
50
|
-
*
|
|
51
|
-
* @param {string} groupName - The group name.
|
|
52
|
-
* @returns {Set<string>} The cache keys in the group.
|
|
53
|
-
*/
|
|
54
|
-
getGroupKeys(groupName) {
|
|
55
|
-
return this.groups.get(groupName)?.keys ?? new Set();
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Invalidates a single group, clearing its keys and recording the timestamp.
|
|
59
|
-
*
|
|
60
|
-
* @param {string} groupName - The group name to invalidate.
|
|
61
|
-
* @returns {string[]} The cache keys that were in the invalidated group.
|
|
62
|
-
*/
|
|
63
|
-
invalidate(groupName) {
|
|
64
|
-
const group = this.groups.get(groupName);
|
|
65
|
-
if (!group)
|
|
66
|
-
return [];
|
|
67
|
-
const keys = [...group.keys];
|
|
68
|
-
group.keys.clear();
|
|
69
|
-
group.lastInvalidated = Date.now();
|
|
70
|
-
return keys;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Invalidates all groups, clearing their keys and recording the timestamp.
|
|
74
|
-
*
|
|
75
|
-
* @returns {string[]} All unique cache keys that were invalidated.
|
|
76
|
-
*/
|
|
77
|
-
invalidateAll() {
|
|
78
|
-
const allKeys = new Set();
|
|
79
|
-
for (const group of this.groups.values()) {
|
|
80
|
-
for (const key of group.keys) {
|
|
81
|
-
allKeys.add(key);
|
|
82
|
-
}
|
|
83
|
-
group.keys.clear();
|
|
84
|
-
group.lastInvalidated = Date.now();
|
|
85
|
-
}
|
|
86
|
-
return [...allKeys];
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Checks whether a cache key has been invalidated since a given timestamp.
|
|
90
|
-
*
|
|
91
|
-
* @param {string} cacheKey - The cache key to check.
|
|
92
|
-
* @param {number} storedAt - The timestamp when the entry was stored.
|
|
93
|
-
* @returns {boolean} `true` if the key was invalidated after `storedAt`.
|
|
94
|
-
*/
|
|
95
|
-
isInvalidatedSince(cacheKey, storedAt) {
|
|
96
|
-
for (const group of this.groups.values()) {
|
|
97
|
-
if (group.keys.has(cacheKey) && group.lastInvalidated > storedAt) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Returns the number of tracked groups.
|
|
105
|
-
*
|
|
106
|
-
* @returns {number} The group count.
|
|
107
|
-
*/
|
|
108
|
-
get size() {
|
|
109
|
-
return this.groups.size;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Removes all groups and their key associations.
|
|
113
|
-
*/
|
|
114
|
-
clear() {
|
|
115
|
-
this.groups.clear();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=groups.js.map
|
package/dist/cache/groups.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"groups.js","sourceRoot":"","sources":["../../src/cache/groups.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,MAAM;SACV,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACtC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,eAAe;IACT,MAAM,GAAG,IAAI,GAAG,EAAsB,CAAC;IAExD;;;;;OAKG;IACH,WAAW,CAAC,QAAgB,EAAE,UAAoB;QAChD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,KAAK,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;gBACtD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC/B,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,QAAgB;QAC5B,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AC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YACzC,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,eAAe,GAAG,QAAQ,EAAE,CAAC;gBACjE,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parsed No-Vary-Search header directive (proposal spec).
|
|
3
|
-
*/
|
|
4
|
-
export interface NoVarySearchDirective {
|
|
5
|
-
params: boolean | string[];
|
|
6
|
-
except: string[];
|
|
7
|
-
keyOrder: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Parses a No-Vary-Search header value into a structured directive.
|
|
11
|
-
*
|
|
12
|
-
* @param {string} header - The raw No-Vary-Search header value.
|
|
13
|
-
* @returns {NoVarySearchDirective|null} The parsed directive, or `null` if the header is empty.
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseNoVarySearch(header: string): NoVarySearchDirective | null;
|
|
16
|
-
/**
|
|
17
|
-
* Determines whether two URLs match according to a No-Vary-Search directive.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} cachedUrl - The URL of the cached response.
|
|
20
|
-
* @param {string} requestUrl - The URL of the incoming request.
|
|
21
|
-
* @param {NoVarySearchDirective} directive - The No-Vary-Search directive to apply.
|
|
22
|
-
* @returns {boolean} `true` if the URLs are considered equivalent under the directive.
|
|
23
|
-
*/
|
|
24
|
-
export declare function urlsMatchWithNoVarySearch(cachedUrl: string, requestUrl: string, directive: NoVarySearchDirective): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Normalizes a URL for cache key generation by applying No-Vary-Search filtering.
|
|
27
|
-
*
|
|
28
|
-
* @param {string} url - The URL to normalize.
|
|
29
|
-
* @param {NoVarySearchDirective} directive - The No-Vary-Search directive to apply.
|
|
30
|
-
* @returns {string} The normalized URL string.
|
|
31
|
-
*/
|
|
32
|
-
export declare function normalizeUrlForCache(url: string, directive: NoVarySearchDirective): string;
|
|
33
|
-
//# sourceMappingURL=no-vary-search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-vary-search.d.ts","sourceRoot":"","sources":["../../src/cache/no-vary-search.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CA4B9E;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAwB1H;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,MAAM,CAiB1F"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a No-Vary-Search header value into a structured directive.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} header - The raw No-Vary-Search header value.
|
|
5
|
-
* @returns {NoVarySearchDirective|null} The parsed directive, or `null` if the header is empty.
|
|
6
|
-
*/
|
|
7
|
-
export function parseNoVarySearch(header) {
|
|
8
|
-
if (!header)
|
|
9
|
-
return null;
|
|
10
|
-
const directive = {
|
|
11
|
-
params: false,
|
|
12
|
-
except: [],
|
|
13
|
-
keyOrder: false,
|
|
14
|
-
};
|
|
15
|
-
const parts = header.split(",").map((s) => s.trim());
|
|
16
|
-
for (const part of parts) {
|
|
17
|
-
if (part === "params") {
|
|
18
|
-
directive.params = true;
|
|
19
|
-
}
|
|
20
|
-
else if (part === "key-order") {
|
|
21
|
-
directive.keyOrder = true;
|
|
22
|
-
}
|
|
23
|
-
else if (part.startsWith("params=")) {
|
|
24
|
-
const listStr = part.substring("params=".length).trim();
|
|
25
|
-
const parsed = parseInnerList(listStr);
|
|
26
|
-
if (parsed)
|
|
27
|
-
directive.params = parsed;
|
|
28
|
-
}
|
|
29
|
-
else if (part.startsWith("except=")) {
|
|
30
|
-
const listStr = part.substring("except=".length).trim();
|
|
31
|
-
const parsed = parseInnerList(listStr);
|
|
32
|
-
if (parsed)
|
|
33
|
-
directive.except = parsed;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return directive;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Determines whether two URLs match according to a No-Vary-Search directive.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} cachedUrl - The URL of the cached response.
|
|
42
|
-
* @param {string} requestUrl - The URL of the incoming request.
|
|
43
|
-
* @param {NoVarySearchDirective} directive - The No-Vary-Search directive to apply.
|
|
44
|
-
* @returns {boolean} `true` if the URLs are considered equivalent under the directive.
|
|
45
|
-
*/
|
|
46
|
-
export function urlsMatchWithNoVarySearch(cachedUrl, requestUrl, directive) {
|
|
47
|
-
let cached;
|
|
48
|
-
let request;
|
|
49
|
-
try {
|
|
50
|
-
cached = new URL(cachedUrl);
|
|
51
|
-
request = new URL(requestUrl);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
if (cached.origin !== request.origin)
|
|
57
|
-
return false;
|
|
58
|
-
if (cached.pathname !== request.pathname)
|
|
59
|
-
return false;
|
|
60
|
-
const cachedParams = new URLSearchParams(cached.search);
|
|
61
|
-
const requestParams = new URLSearchParams(request.search);
|
|
62
|
-
const filteredCached = filterParams(cachedParams, directive);
|
|
63
|
-
const filteredRequest = filterParams(requestParams, directive);
|
|
64
|
-
if (directive.keyOrder) {
|
|
65
|
-
return paramsEqualUnordered(filteredCached, filteredRequest);
|
|
66
|
-
}
|
|
67
|
-
return paramsEqualOrdered(filteredCached, filteredRequest);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Normalizes a URL for cache key generation by applying No-Vary-Search filtering.
|
|
71
|
-
*
|
|
72
|
-
* @param {string} url - The URL to normalize.
|
|
73
|
-
* @param {NoVarySearchDirective} directive - The No-Vary-Search directive to apply.
|
|
74
|
-
* @returns {string} The normalized URL string.
|
|
75
|
-
*/
|
|
76
|
-
export function normalizeUrlForCache(url, directive) {
|
|
77
|
-
let parsed;
|
|
78
|
-
try {
|
|
79
|
-
parsed = new URL(url);
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
return url;
|
|
83
|
-
}
|
|
84
|
-
const params = new URLSearchParams(parsed.search);
|
|
85
|
-
const filtered = filterParams(params, directive);
|
|
86
|
-
if (directive.keyOrder) {
|
|
87
|
-
filtered.sort();
|
|
88
|
-
}
|
|
89
|
-
parsed.search = filtered.toString();
|
|
90
|
-
return parsed.href;
|
|
91
|
-
}
|
|
92
|
-
function filterParams(params, directive) {
|
|
93
|
-
const result = new URLSearchParams();
|
|
94
|
-
if (directive.params === true) {
|
|
95
|
-
for (const [key, value] of params) {
|
|
96
|
-
if (directive.except.includes(key)) {
|
|
97
|
-
result.append(key, value);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else if (Array.isArray(directive.params)) {
|
|
102
|
-
for (const [key, value] of params) {
|
|
103
|
-
if (!directive.params.includes(key)) {
|
|
104
|
-
result.append(key, value);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
for (const [key, value] of params) {
|
|
110
|
-
result.append(key, value);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
function paramsEqualUnordered(a, b) {
|
|
116
|
-
const aEntries = [...a.entries()].sort(([k1, v1], [k2, v2]) => (k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : v1 > v2 ? 1 : 0));
|
|
117
|
-
const bEntries = [...b.entries()].sort(([k1, v1], [k2, v2]) => (k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : v1 > v2 ? 1 : 0));
|
|
118
|
-
if (aEntries.length !== bEntries.length)
|
|
119
|
-
return false;
|
|
120
|
-
for (let i = 0; i < aEntries.length; i++) {
|
|
121
|
-
if (aEntries[i][0] !== bEntries[i][0] || aEntries[i][1] !== bEntries[i][1]) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
function paramsEqualOrdered(a, b) {
|
|
128
|
-
const aEntries = [...a.entries()];
|
|
129
|
-
const bEntries = [...b.entries()];
|
|
130
|
-
if (aEntries.length !== bEntries.length)
|
|
131
|
-
return false;
|
|
132
|
-
for (let i = 0; i < aEntries.length; i++) {
|
|
133
|
-
if (aEntries[i][0] !== bEntries[i][0] || aEntries[i][1] !== bEntries[i][1]) {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
function parseInnerList(str) {
|
|
140
|
-
const match = str.match(/^\(([^)]*)\)/);
|
|
141
|
-
if (!match)
|
|
142
|
-
return null;
|
|
143
|
-
return match[1]
|
|
144
|
-
.split(/\s+/)
|
|
145
|
-
.map((s) => s.replace(/"/g, "").trim())
|
|
146
|
-
.filter(Boolean);
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=no-vary-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-vary-search.js","sourceRoot":"","sources":["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B,CAAC"}
|
package/dist/cache/range.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parsed Content-Range header fields.
|
|
3
|
-
*/
|
|
4
|
-
export interface ContentRange {
|
|
5
|
-
unit: string;
|
|
6
|
-
start: number;
|
|
7
|
-
end: number;
|
|
8
|
-
total: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A contiguous byte range segment stored in cache.
|
|
12
|
-
*/
|
|
13
|
-
export interface RangeSegment {
|
|
14
|
-
start: number;
|
|
15
|
-
end: number;
|
|
16
|
-
data: Buffer;
|
|
17
|
-
etag?: string;
|
|
18
|
-
storedAt: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Represents all cached range segments for a given URL.
|
|
22
|
-
*/
|
|
23
|
-
export interface RangeCacheEntry {
|
|
24
|
-
url: string;
|
|
25
|
-
segments: RangeSegment[];
|
|
26
|
-
totalSize: number;
|
|
27
|
-
etag?: string;
|
|
28
|
-
lastModified?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Parses a Content-Range header value into its component fields.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} header - The raw Content-Range header value.
|
|
34
|
-
* @returns {ContentRange|null} The parsed range, or `null` if the header is malformed.
|
|
35
|
-
*/
|
|
36
|
-
export declare function parseContentRange(header: string): ContentRange | null;
|
|
37
|
-
/**
|
|
38
|
-
* Parses a Range request header into an array of byte ranges.
|
|
39
|
-
*
|
|
40
|
-
* @param {string} header - The raw Range header value (e.g. "bytes=0-499,1000-1499").
|
|
41
|
-
* @returns {Array<[number, number|undefined]>|null} Parsed ranges, or `null` if invalid.
|
|
42
|
-
*/
|
|
43
|
-
export declare function parseRangeHeader(header: string): Array<[number, number | undefined]> | null;
|
|
44
|
-
/**
|
|
45
|
-
* Caches partial HTTP responses (206 Partial Content) and reassembles
|
|
46
|
-
* byte ranges on subsequent lookups.
|
|
47
|
-
*
|
|
48
|
-
* @class
|
|
49
|
-
*/
|
|
50
|
-
export declare class RangeCache {
|
|
51
|
-
private readonly entries;
|
|
52
|
-
private readonly maxEntries;
|
|
53
|
-
private readonly maxSegmentsPerEntry;
|
|
54
|
-
/**
|
|
55
|
-
* Creates a new RangeCache.
|
|
56
|
-
*
|
|
57
|
-
* @param {Object} [config] - Optional cache limits.
|
|
58
|
-
* @param {number} [config.maxEntries=200] - Maximum number of URLs to cache.
|
|
59
|
-
* @param {number} [config.maxSegmentsPerEntry=100] - Maximum segments per URL.
|
|
60
|
-
*/
|
|
61
|
-
constructor(config?: {
|
|
62
|
-
maxEntries?: number;
|
|
63
|
-
maxSegmentsPerEntry?: number;
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* Stores a range segment for the given URL.
|
|
67
|
-
*
|
|
68
|
-
* @param {string} url - The resource URL.
|
|
69
|
-
* @param {ContentRange} range - The content range descriptor.
|
|
70
|
-
* @param {Buffer} data - The response body bytes for this range.
|
|
71
|
-
* @param {Object} [meta] - Optional metadata.
|
|
72
|
-
* @param {string} [meta.etag] - The entity tag for cache coherence.
|
|
73
|
-
* @param {string} [meta.lastModified] - The Last-Modified date.
|
|
74
|
-
*/
|
|
75
|
-
store(url: string, range: ContentRange, data: Buffer, meta?: {
|
|
76
|
-
etag?: string;
|
|
77
|
-
lastModified?: string;
|
|
78
|
-
}): void;
|
|
79
|
-
/**
|
|
80
|
-
* Looks up cached bytes for a given byte range.
|
|
81
|
-
*
|
|
82
|
-
* @param {string} url - The resource URL.
|
|
83
|
-
* @param {number} start - Start byte offset (inclusive).
|
|
84
|
-
* @param {number} end - End byte offset (inclusive).
|
|
85
|
-
* @returns {Buffer|null} The cached bytes, or `null` on a miss.
|
|
86
|
-
*/
|
|
87
|
-
lookup(url: string, start: number, end: number): Buffer | null;
|
|
88
|
-
/**
|
|
89
|
-
* Checks whether all bytes for a URL have been cached.
|
|
90
|
-
*
|
|
91
|
-
* @param {string} url - The resource URL.
|
|
92
|
-
* @returns {boolean} `true` if the full resource is cached.
|
|
93
|
-
*/
|
|
94
|
-
isComplete(url: string): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Returns the range cache entry for a URL, if present.
|
|
97
|
-
*
|
|
98
|
-
* @param {string} url - The resource URL.
|
|
99
|
-
* @returns {RangeCacheEntry|undefined} The cached entry.
|
|
100
|
-
*/
|
|
101
|
-
get(url: string): RangeCacheEntry | undefined;
|
|
102
|
-
/**
|
|
103
|
-
* Removes the cache entry for a URL.
|
|
104
|
-
*
|
|
105
|
-
* @param {string} url - The resource URL to evict.
|
|
106
|
-
* @returns {boolean} `true` if an entry was removed.
|
|
107
|
-
*/
|
|
108
|
-
delete(url: string): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Removes all cached range entries.
|
|
111
|
-
*/
|
|
112
|
-
clear(): void;
|
|
113
|
-
/**
|
|
114
|
-
* Returns the number of URLs with cached ranges.
|
|
115
|
-
*
|
|
116
|
-
* @returns {number} The entry count.
|
|
117
|
-
*/
|
|
118
|
-
get size(): number;
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=range.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/cache/range.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,YAAY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