@milaboratories/pframes-rs-serv 1.1.18 → 1.1.20
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/export.cjs +16 -17
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.ts +6 -2
- package/dist/export.d.ts.map +1 -1
- package/dist/export.js +16 -15
- package/dist/export.js.map +1 -1
- package/dist/fs-store.cjs +83 -87
- package/dist/fs-store.cjs.map +1 -1
- package/dist/fs-store.d.ts +14 -10
- package/dist/fs-store.d.ts.map +1 -1
- package/dist/fs-store.js +83 -85
- package/dist/fs-store.js.map +1 -1
- package/dist/handler.cjs +132 -157
- package/dist/handler.cjs.map +1 -1
- package/dist/handler.d.ts +8 -4
- package/dist/handler.d.ts.map +1 -1
- package/dist/handler.js +132 -155
- package/dist/handler.js.map +1 -1
- package/dist/index.cjs +13 -18
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/parquet-server.cjs +95 -101
- package/dist/parquet-server.cjs.map +1 -1
- package/dist/parquet-server.d.ts +16 -12
- package/dist/parquet-server.d.ts.map +1 -1
- package/dist/parquet-server.js +95 -98
- package/dist/parquet-server.js.map +1 -1
- package/dist/serve.cjs +98 -94
- package/dist/serve.cjs.map +1 -1
- package/dist/serve.d.ts +11 -2
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +98 -92
- package/dist/serve.js.map +1 -1
- package/dist/utils/etag.cjs +5 -7
- package/dist/utils/etag.cjs.map +1 -1
- package/dist/utils/etag.js +5 -5
- package/dist/utils/etag.js.map +1 -1
- package/dist/utils/filename.cjs +9 -11
- package/dist/utils/filename.cjs.map +1 -1
- package/dist/utils/filename.js +9 -9
- package/dist/utils/filename.js.map +1 -1
- package/dist/utils/headers.cjs +28 -21
- package/dist/utils/headers.cjs.map +1 -1
- package/dist/utils/headers.js +28 -19
- package/dist/utils/headers.js.map +1 -1
- package/dist/utils/method.cjs +7 -7
- package/dist/utils/method.cjs.map +1 -1
- package/dist/utils/method.js +7 -5
- package/dist/utils/method.js.map +1 -1
- package/dist/utils/options.cjs +111 -134
- package/dist/utils/options.cjs.map +1 -1
- package/dist/utils/options.js +111 -132
- package/dist/utils/options.js.map +1 -1
- package/dist/utils/range.cjs +26 -31
- package/dist/utils/range.cjs.map +1 -1
- package/dist/utils/range.js +26 -29
- package/dist/utils/range.js.map +1 -1
- package/dist/utils/status.cjs +17 -17
- package/dist/utils/status.cjs.map +1 -1
- package/dist/utils/status.js +17 -15
- package/dist/utils/status.js.map +1 -1
- package/package.json +4 -4
- package/src/parquet-server.ts +16 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/utils/etag.d.ts +0 -15
- package/dist/utils/etag.d.ts.map +0 -1
- package/dist/utils/filename.d.ts +0 -4
- package/dist/utils/filename.d.ts.map +0 -1
- package/dist/utils/headers.d.ts +0 -31
- package/dist/utils/headers.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/method.d.ts +0 -6
- package/dist/utils/method.d.ts.map +0 -1
- package/dist/utils/options.d.ts +0 -64
- package/dist/utils/options.d.ts.map +0 -1
- package/dist/utils/range.d.ts +0 -4
- package/dist/utils/range.d.ts.map +0 -1
- package/dist/utils/status.d.ts +0 -17
- package/dist/utils/status.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filename.js","sources":["../../src/utils/filename.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingMessage } from \"node:http\";\n\nconst PARQUET_FILENAME_REGEX = /^\\/([\\w\\-.]+.parquet)$/;\n\nexport function getFilenameFromUrl(\n request: IncomingMessage,\n): PFrameInternal.ParquetFileName | null {\n const url = request.url;\n if (url === undefined) return null;\n\n const match = url.match(PARQUET_FILENAME_REGEX);\n if (!match) return null;\n\n return match[1] as PFrameInternal.ParquetFileName;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"filename.js","names":[],"sources":["../../src/utils/filename.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingMessage } from \"node:http\";\n\nconst PARQUET_FILENAME_REGEX = /^\\/([\\w\\-.]+.parquet)$/;\n\nexport function getFilenameFromUrl(\n request: IncomingMessage,\n): PFrameInternal.ParquetFileName | null {\n const url = request.url;\n if (url === undefined) return null;\n\n const match = url.match(PARQUET_FILENAME_REGEX);\n if (!match) return null;\n\n return match[1] as PFrameInternal.ParquetFileName;\n}\n"],"mappings":";AAGA,MAAM,yBAAyB;AAE/B,SAAgB,mBACd,SACuC;CACvC,MAAM,MAAM,QAAQ;AACpB,KAAI,QAAQ,KAAA,EAAW,QAAO;CAE9B,MAAM,QAAQ,IAAI,MAAM,uBAAuB;AAC/C,KAAI,CAAC,MAAO,QAAO;AAEnB,QAAO,MAAM"}
|
package/dist/utils/headers.cjs
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/headers.ts
|
|
3
2
|
/** HTTP header names used in the parquet server handler */
|
|
4
3
|
const HeaderName = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
Accept: "accept",
|
|
5
|
+
AcceptRanges: "accept-ranges",
|
|
6
|
+
Allow: "allow",
|
|
7
|
+
Authorization: "authorization",
|
|
8
|
+
CacheControl: "cache-control",
|
|
9
|
+
Connection: "connection",
|
|
10
|
+
ContentLength: "content-length",
|
|
11
|
+
ContentRange: "content-range",
|
|
12
|
+
ContentType: "content-type",
|
|
13
|
+
Date: "date",
|
|
14
|
+
ETag: "etag",
|
|
15
|
+
IfMatch: "if-match",
|
|
16
|
+
IfModifiedSince: "if-modified-since",
|
|
17
|
+
IfNoneMatch: "if-none-match",
|
|
18
|
+
IfUnmodifiedSince: "if-unmodified-since",
|
|
19
|
+
LastModified: "last-modified",
|
|
20
|
+
Range: "range",
|
|
21
|
+
WWWAuthenticate: "www-authenticate"
|
|
16
22
|
};
|
|
17
23
|
/** HTTP header values used in the parquet server handler */
|
|
18
24
|
const HeaderValue = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
AcceptRanges: "bytes",
|
|
26
|
+
Allow: "GET, HEAD",
|
|
27
|
+
CacheControl: "public, immutable, max-age=31536000",
|
|
28
|
+
Connection: "close",
|
|
29
|
+
ContentType: "application/octet-stream",
|
|
30
|
+
WWWAuthenticate: "Bearer realm=\"parquet-server\""
|
|
25
31
|
};
|
|
26
|
-
|
|
32
|
+
//#endregion
|
|
27
33
|
exports.HeaderName = HeaderName;
|
|
28
34
|
exports.HeaderValue = HeaderValue;
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=headers.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.cjs","sources":["../../src/utils/headers.ts"],"sourcesContent":["/** HTTP header names used in the parquet server handler */\nexport const HeaderName = {\n Accept: \"accept\",\n AcceptRanges: \"accept-ranges\",\n Allow: \"allow\",\n Authorization: \"authorization\",\n CacheControl: \"cache-control\",\n Connection: \"connection\",\n ContentLength: \"content-length\",\n ContentRange: \"content-range\",\n ContentType: \"content-type\",\n Date: \"date\",\n ETag: \"etag\",\n IfMatch: \"if-match\",\n IfModifiedSince: \"if-modified-since\",\n IfNoneMatch: \"if-none-match\",\n IfUnmodifiedSince: \"if-unmodified-since\",\n LastModified: \"last-modified\",\n Range: \"range\",\n WWWAuthenticate: \"www-authenticate\",\n} as const;\n\n/** HTTP header values used in the parquet server handler */\nexport const HeaderValue = {\n AcceptRanges: \"bytes\",\n Allow: \"GET, HEAD\",\n CacheControl: \"public, immutable, max-age=31536000\",\n Connection: \"close\",\n ContentType: \"application/octet-stream\",\n WWWAuthenticate: 'Bearer realm=\"parquet-server\"',\n} as const;\n"],"
|
|
1
|
+
{"version":3,"file":"headers.cjs","names":[],"sources":["../../src/utils/headers.ts"],"sourcesContent":["/** HTTP header names used in the parquet server handler */\nexport const HeaderName = {\n Accept: \"accept\",\n AcceptRanges: \"accept-ranges\",\n Allow: \"allow\",\n Authorization: \"authorization\",\n CacheControl: \"cache-control\",\n Connection: \"connection\",\n ContentLength: \"content-length\",\n ContentRange: \"content-range\",\n ContentType: \"content-type\",\n Date: \"date\",\n ETag: \"etag\",\n IfMatch: \"if-match\",\n IfModifiedSince: \"if-modified-since\",\n IfNoneMatch: \"if-none-match\",\n IfUnmodifiedSince: \"if-unmodified-since\",\n LastModified: \"last-modified\",\n Range: \"range\",\n WWWAuthenticate: \"www-authenticate\",\n} as const;\n\n/** HTTP header values used in the parquet server handler */\nexport const HeaderValue = {\n AcceptRanges: \"bytes\",\n Allow: \"GET, HEAD\",\n CacheControl: \"public, immutable, max-age=31536000\",\n Connection: \"close\",\n ContentType: \"application/octet-stream\",\n WWWAuthenticate: 'Bearer realm=\"parquet-server\"',\n} as const;\n"],"mappings":";;AACA,MAAa,aAAa;CACxB,QAAQ;CACR,cAAc;CACd,OAAO;CACP,eAAe;CACf,cAAc;CACd,YAAY;CACZ,eAAe;CACf,cAAc;CACd,aAAa;CACb,MAAM;CACN,MAAM;CACN,SAAS;CACT,iBAAiB;CACjB,aAAa;CACb,mBAAmB;CACnB,cAAc;CACd,OAAO;CACP,iBAAiB;CAClB;;AAGD,MAAa,cAAc;CACzB,cAAc;CACd,OAAO;CACP,cAAc;CACd,YAAY;CACZ,aAAa;CACb,iBAAiB;CAClB"}
|
package/dist/utils/headers.js
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
1
|
+
//#region src/utils/headers.ts
|
|
1
2
|
/** HTTP header names used in the parquet server handler */
|
|
2
3
|
const HeaderName = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
Accept: "accept",
|
|
5
|
+
AcceptRanges: "accept-ranges",
|
|
6
|
+
Allow: "allow",
|
|
7
|
+
Authorization: "authorization",
|
|
8
|
+
CacheControl: "cache-control",
|
|
9
|
+
Connection: "connection",
|
|
10
|
+
ContentLength: "content-length",
|
|
11
|
+
ContentRange: "content-range",
|
|
12
|
+
ContentType: "content-type",
|
|
13
|
+
Date: "date",
|
|
14
|
+
ETag: "etag",
|
|
15
|
+
IfMatch: "if-match",
|
|
16
|
+
IfModifiedSince: "if-modified-since",
|
|
17
|
+
IfNoneMatch: "if-none-match",
|
|
18
|
+
IfUnmodifiedSince: "if-unmodified-since",
|
|
19
|
+
LastModified: "last-modified",
|
|
20
|
+
Range: "range",
|
|
21
|
+
WWWAuthenticate: "www-authenticate"
|
|
14
22
|
};
|
|
15
23
|
/** HTTP header values used in the parquet server handler */
|
|
16
24
|
const HeaderValue = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
AcceptRanges: "bytes",
|
|
26
|
+
Allow: "GET, HEAD",
|
|
27
|
+
CacheControl: "public, immutable, max-age=31536000",
|
|
28
|
+
Connection: "close",
|
|
29
|
+
ContentType: "application/octet-stream",
|
|
30
|
+
WWWAuthenticate: "Bearer realm=\"parquet-server\""
|
|
23
31
|
};
|
|
24
|
-
|
|
32
|
+
//#endregion
|
|
25
33
|
export { HeaderName, HeaderValue };
|
|
26
|
-
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=headers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sources":["../../src/utils/headers.ts"],"sourcesContent":["/** HTTP header names used in the parquet server handler */\nexport const HeaderName = {\n Accept: \"accept\",\n AcceptRanges: \"accept-ranges\",\n Allow: \"allow\",\n Authorization: \"authorization\",\n CacheControl: \"cache-control\",\n Connection: \"connection\",\n ContentLength: \"content-length\",\n ContentRange: \"content-range\",\n ContentType: \"content-type\",\n Date: \"date\",\n ETag: \"etag\",\n IfMatch: \"if-match\",\n IfModifiedSince: \"if-modified-since\",\n IfNoneMatch: \"if-none-match\",\n IfUnmodifiedSince: \"if-unmodified-since\",\n LastModified: \"last-modified\",\n Range: \"range\",\n WWWAuthenticate: \"www-authenticate\",\n} as const;\n\n/** HTTP header values used in the parquet server handler */\nexport const HeaderValue = {\n AcceptRanges: \"bytes\",\n Allow: \"GET, HEAD\",\n CacheControl: \"public, immutable, max-age=31536000\",\n Connection: \"close\",\n ContentType: \"application/octet-stream\",\n WWWAuthenticate: 'Bearer realm=\"parquet-server\"',\n} as const;\n"],"
|
|
1
|
+
{"version":3,"file":"headers.js","names":[],"sources":["../../src/utils/headers.ts"],"sourcesContent":["/** HTTP header names used in the parquet server handler */\nexport const HeaderName = {\n Accept: \"accept\",\n AcceptRanges: \"accept-ranges\",\n Allow: \"allow\",\n Authorization: \"authorization\",\n CacheControl: \"cache-control\",\n Connection: \"connection\",\n ContentLength: \"content-length\",\n ContentRange: \"content-range\",\n ContentType: \"content-type\",\n Date: \"date\",\n ETag: \"etag\",\n IfMatch: \"if-match\",\n IfModifiedSince: \"if-modified-since\",\n IfNoneMatch: \"if-none-match\",\n IfUnmodifiedSince: \"if-unmodified-since\",\n LastModified: \"last-modified\",\n Range: \"range\",\n WWWAuthenticate: \"www-authenticate\",\n} as const;\n\n/** HTTP header values used in the parquet server handler */\nexport const HeaderValue = {\n AcceptRanges: \"bytes\",\n Allow: \"GET, HEAD\",\n CacheControl: \"public, immutable, max-age=31536000\",\n Connection: \"close\",\n ContentType: \"application/octet-stream\",\n WWWAuthenticate: 'Bearer realm=\"parquet-server\"',\n} as const;\n"],"mappings":";;AACA,MAAa,aAAa;CACxB,QAAQ;CACR,cAAc;CACd,OAAO;CACP,eAAe;CACf,cAAc;CACd,YAAY;CACZ,eAAe;CACf,cAAc;CACd,aAAa;CACb,MAAM;CACN,MAAM;CACN,SAAS;CACT,iBAAiB;CACjB,aAAa;CACb,mBAAmB;CACnB,cAAc;CACd,OAAO;CACP,iBAAiB;CAClB;;AAGD,MAAa,cAAc;CACzB,cAAc;CACd,OAAO;CACP,cAAc;CACd,YAAY;CACZ,aAAa;CACb,iBAAiB;CAClB"}
|
package/dist/utils/method.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/method.ts
|
|
3
2
|
function isGetOrHead(method) {
|
|
4
|
-
|
|
3
|
+
return method === "GET" || method === "HEAD";
|
|
5
4
|
}
|
|
6
5
|
function isGet(method) {
|
|
7
|
-
|
|
6
|
+
return method === "GET";
|
|
8
7
|
}
|
|
9
8
|
function isHead(method) {
|
|
10
|
-
|
|
9
|
+
return method === "HEAD";
|
|
11
10
|
}
|
|
12
|
-
|
|
11
|
+
//#endregion
|
|
13
12
|
exports.isGet = isGet;
|
|
14
13
|
exports.isGetOrHead = isGetOrHead;
|
|
15
14
|
exports.isHead = isHead;
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=method.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.cjs","sources":["../../src/utils/method.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingHttpHeaders } from \"node:http\";\n\nexport function isGetOrHead(\n method: IncomingHttpHeaders[\"method\"],\n): method is PFrameInternal.HttpMethod {\n return method === \"GET\" || method === \"HEAD\";\n}\n\nexport function isGet(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"GET\"> {\n return method === \"GET\";\n}\n\nexport function isHead(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"HEAD\"> {\n return method === \"HEAD\";\n}\n"],"
|
|
1
|
+
{"version":3,"file":"method.cjs","names":[],"sources":["../../src/utils/method.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingHttpHeaders } from \"node:http\";\n\nexport function isGetOrHead(\n method: IncomingHttpHeaders[\"method\"],\n): method is PFrameInternal.HttpMethod {\n return method === \"GET\" || method === \"HEAD\";\n}\n\nexport function isGet(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"GET\"> {\n return method === \"GET\";\n}\n\nexport function isHead(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"HEAD\"> {\n return method === \"HEAD\";\n}\n"],"mappings":";AAGA,SAAgB,YACd,QACqC;AACrC,QAAO,WAAW,SAAS,WAAW;;AAGxC,SAAgB,MACd,QACqD;AACrD,QAAO,WAAW;;AAGpB,SAAgB,OACd,QACsD;AACtD,QAAO,WAAW"}
|
package/dist/utils/method.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
//#region src/utils/method.ts
|
|
1
2
|
function isGetOrHead(method) {
|
|
2
|
-
|
|
3
|
+
return method === "GET" || method === "HEAD";
|
|
3
4
|
}
|
|
4
5
|
function isGet(method) {
|
|
5
|
-
|
|
6
|
+
return method === "GET";
|
|
6
7
|
}
|
|
7
8
|
function isHead(method) {
|
|
8
|
-
|
|
9
|
+
return method === "HEAD";
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
//#endregion
|
|
11
12
|
export { isGet, isGetOrHead, isHead };
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=method.js.map
|
package/dist/utils/method.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.js","sources":["../../src/utils/method.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingHttpHeaders } from \"node:http\";\n\nexport function isGetOrHead(\n method: IncomingHttpHeaders[\"method\"],\n): method is PFrameInternal.HttpMethod {\n return method === \"GET\" || method === \"HEAD\";\n}\n\nexport function isGet(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"GET\"> {\n return method === \"GET\";\n}\n\nexport function isHead(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"HEAD\"> {\n return method === \"HEAD\";\n}\n"],"
|
|
1
|
+
{"version":3,"file":"method.js","names":[],"sources":["../../src/utils/method.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingHttpHeaders } from \"node:http\";\n\nexport function isGetOrHead(\n method: IncomingHttpHeaders[\"method\"],\n): method is PFrameInternal.HttpMethod {\n return method === \"GET\" || method === \"HEAD\";\n}\n\nexport function isGet(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"GET\"> {\n return method === \"GET\";\n}\n\nexport function isHead(\n method: PFrameInternal.HttpMethod,\n): method is Extract<PFrameInternal.HttpMethod, \"HEAD\"> {\n return method === \"HEAD\";\n}\n"],"mappings":";AAGA,SAAgB,YACd,QACqC;AACrC,QAAO,WAAW,SAAS,WAAW;;AAGxC,SAAgB,MACd,QACqD;AACrD,QAAO,WAAW;;AAGpB,SAAgB,OACd,QACsD;AACtD,QAAO,WAAW"}
|
package/dist/utils/options.cjs
CHANGED
|
@@ -1,135 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (this.ifMatch === null && this.ifUnmodifiedSince !== null) {
|
|
111
|
-
return !this.ifUnmodifiedSince.matches(mtime);
|
|
112
|
-
}
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* RFC 9110 section 13.1.2: If-None-Match precondition evaluation
|
|
117
|
-
* RFC 9110 section 13.1.3: If-Modified-Since precondition evaluation
|
|
118
|
-
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>
|
|
119
|
-
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>
|
|
120
|
-
*/
|
|
121
|
-
notModified(etag, mtime) {
|
|
122
|
-
// If-None-Match takes precedence over If-Modified-Since
|
|
123
|
-
if (this.ifNoneMatch !== null) {
|
|
124
|
-
return this.ifNoneMatch.matches(etag);
|
|
125
|
-
}
|
|
126
|
-
// If-Modified-Since (only if no If-None-Match header)
|
|
127
|
-
if (this.ifModifiedSince !== null) {
|
|
128
|
-
return this.ifModifiedSince.matches(mtime);
|
|
129
|
-
}
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
1
|
+
//#region src/utils/options.ts
|
|
2
|
+
var EtagMatch = class EtagMatch {
|
|
3
|
+
constructor(etagMatch) {
|
|
4
|
+
this.etagMatch = etagMatch;
|
|
5
|
+
}
|
|
6
|
+
static parse(etagMatch) {
|
|
7
|
+
if (etagMatch === void 0) return null;
|
|
8
|
+
if (etagMatch === "*") return new EtagMatch({ type: "wildcard" });
|
|
9
|
+
else return new EtagMatch({
|
|
10
|
+
type: "match",
|
|
11
|
+
value: etagMatch.split(",").map((etag) => etag.trim())
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
matches(etag) {
|
|
15
|
+
switch (this.etagMatch.type) {
|
|
16
|
+
case "match": return this.etagMatch.value.includes(etag);
|
|
17
|
+
case "wildcard": return true;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var DateMatch = class DateMatch {
|
|
22
|
+
constructor(mtime) {
|
|
23
|
+
this.mtime = mtime;
|
|
24
|
+
}
|
|
25
|
+
static parse(dateMatch) {
|
|
26
|
+
if (dateMatch === void 0) return null;
|
|
27
|
+
const time = Date.parse(dateMatch);
|
|
28
|
+
if (isNaN(time)) return null;
|
|
29
|
+
return new DateMatch(new Date(time));
|
|
30
|
+
}
|
|
31
|
+
matches(mtime) {
|
|
32
|
+
return this.mtime.getTime() / 1e3 === mtime.getTime() / 1e3;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var Options = class {
|
|
36
|
+
/**
|
|
37
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#name-if-match>
|
|
38
|
+
*
|
|
39
|
+
* Examples:
|
|
40
|
+
*
|
|
41
|
+
* ```text
|
|
42
|
+
* If-Match: "xyzzy"
|
|
43
|
+
* If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
|
|
44
|
+
* If-Match: *
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
ifMatch;
|
|
48
|
+
/**
|
|
49
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>
|
|
50
|
+
*
|
|
51
|
+
* Examples:
|
|
52
|
+
*
|
|
53
|
+
* ```text
|
|
54
|
+
* If-None-Match: "xyzzy"
|
|
55
|
+
* If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
|
|
56
|
+
* If-None-Match: *
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
ifNoneMatch;
|
|
60
|
+
/**
|
|
61
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>
|
|
62
|
+
*
|
|
63
|
+
* Examples:
|
|
64
|
+
*
|
|
65
|
+
* ```text
|
|
66
|
+
* If-Modified-Since: Mon, 07 Jan 2002 19:43:36 GMT
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
ifModifiedSince;
|
|
70
|
+
/**
|
|
71
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>
|
|
72
|
+
*
|
|
73
|
+
* Examples:
|
|
74
|
+
*
|
|
75
|
+
* ```text
|
|
76
|
+
* If-Unmodified-Since: Mon, 07 Jan 2002 19:43:36 GMT
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
ifUnmodifiedSince;
|
|
80
|
+
constructor(request) {
|
|
81
|
+
this.ifMatch = EtagMatch.parse(request.headers["if-match"]);
|
|
82
|
+
this.ifNoneMatch = EtagMatch.parse(request.headers["if-none-match"]);
|
|
83
|
+
this.ifModifiedSince = DateMatch.parse(request.headers["if-modified-since"]);
|
|
84
|
+
this.ifUnmodifiedSince = DateMatch.parse(request.headers["if-unmodified-since"]);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* RFC 9110 section 13.1.1: If-Match precondition evaluation
|
|
88
|
+
* RFC 9110 section 13.1.4: If-Unmodified-Since precondition evaluation
|
|
89
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.1>
|
|
90
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>
|
|
91
|
+
*/
|
|
92
|
+
preconditionFailed(etag, mtime) {
|
|
93
|
+
if (this.ifMatch !== null && !this.ifMatch.matches(etag)) return true;
|
|
94
|
+
if (this.ifMatch === null && this.ifUnmodifiedSince !== null) return !this.ifUnmodifiedSince.matches(mtime);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* RFC 9110 section 13.1.2: If-None-Match precondition evaluation
|
|
99
|
+
* RFC 9110 section 13.1.3: If-Modified-Since precondition evaluation
|
|
100
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>
|
|
101
|
+
* See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>
|
|
102
|
+
*/
|
|
103
|
+
notModified(etag, mtime) {
|
|
104
|
+
if (this.ifNoneMatch !== null) return this.ifNoneMatch.matches(etag);
|
|
105
|
+
if (this.ifModifiedSince !== null) return this.ifModifiedSince.matches(mtime);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
134
110
|
exports.Options = Options;
|
|
135
|
-
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=options.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.cjs","sources":["../../src/utils/options.ts"],"sourcesContent":["import type { IncomingMessage } from \"node:http\";\nimport type { Etag } from \"./etag\";\n\ntype EtagMatchType =\n | {\n type: \"match\";\n value: Etag[];\n }\n | {\n type: \"wildcard\";\n };\n\nclass EtagMatch {\n private constructor(private readonly etagMatch: EtagMatchType) {}\n\n static parse(etagMatch: string | undefined): EtagMatch | null {\n if (etagMatch === undefined) return null;\n if (etagMatch === \"*\") {\n return new EtagMatch({ type: \"wildcard\" });\n } else {\n return new EtagMatch({\n type: \"match\",\n value: etagMatch.split(\",\").map((etag) => etag.trim() as Etag),\n });\n }\n }\n\n matches(etag: Etag): boolean {\n switch (this.etagMatch.type) {\n case \"match\":\n return this.etagMatch.value.includes(etag);\n case \"wildcard\":\n return true;\n }\n }\n}\n\nclass DateMatch {\n private constructor(private readonly mtime: Date) {}\n\n static parse(dateMatch: string | undefined): DateMatch | null {\n if (dateMatch === undefined) return null;\n const time = Date.parse(dateMatch);\n if (isNaN(time)) return null;\n return new DateMatch(new Date(time));\n }\n\n matches(mtime: Date): boolean {\n return this.mtime.getTime() / 1_000 === mtime.getTime() / 1_000;\n }\n}\n\nexport class Options {\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#name-if-match>\n *\n * Examples:\n *\n * ```text\n * If-Match: \"xyzzy\"\n * If-Match: \"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"\n * If-Match: *\n * ```\n */\n private ifMatch: EtagMatch | null;\n\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>\n *\n * Examples:\n *\n * ```text\n * If-None-Match: \"xyzzy\"\n * If-None-Match: \"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"\n * If-None-Match: *\n * ```\n */\n private ifNoneMatch: EtagMatch | null;\n\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>\n *\n * Examples:\n *\n * ```text\n * If-Modified-Since: Mon, 07 Jan 2002 19:43:36 GMT\n * ```\n */\n private ifModifiedSince: DateMatch | null;\n\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>\n *\n * Examples:\n *\n * ```text\n * If-Unmodified-Since: Mon, 07 Jan 2002 19:43:36 GMT\n * ```\n */\n private ifUnmodifiedSince: DateMatch | null;\n\n constructor(request: IncomingMessage) {\n this.ifMatch = EtagMatch.parse(request.headers[\"if-match\"]);\n this.ifNoneMatch = EtagMatch.parse(request.headers[\"if-none-match\"]);\n this.ifModifiedSince = DateMatch.parse(request.headers[\"if-modified-since\"]);\n this.ifUnmodifiedSince = DateMatch.parse(request.headers[\"if-unmodified-since\"]);\n }\n\n /**\n * RFC 9110 section 13.1.1: If-Match precondition evaluation\n * RFC 9110 section 13.1.4: If-Unmodified-Since precondition evaluation\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.1>\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>\n */\n preconditionFailed(etag: Etag, mtime: Date): boolean {\n // If-Match precondition takes precedence\n if (this.ifMatch !== null && !this.ifMatch.matches(etag)) {\n return true;\n }\n\n // If-Unmodified-Since precondition (only if no If-Match header)\n if (this.ifMatch === null && this.ifUnmodifiedSince !== null) {\n return !this.ifUnmodifiedSince.matches(mtime);\n }\n\n return false;\n }\n\n /**\n * RFC 9110 section 13.1.2: If-None-Match precondition evaluation\n * RFC 9110 section 13.1.3: If-Modified-Since precondition evaluation\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>\n */\n notModified(etag: Etag, mtime: Date): boolean {\n // If-None-Match takes precedence over If-Modified-Since\n if (this.ifNoneMatch !== null) {\n return this.ifNoneMatch.matches(etag);\n }\n\n // If-Modified-Since (only if no If-None-Match header)\n if (this.ifModifiedSince !== null) {\n return this.ifModifiedSince.matches(mtime);\n }\n\n return false;\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"options.cjs","names":[],"sources":["../../src/utils/options.ts"],"sourcesContent":["import type { IncomingMessage } from \"node:http\";\nimport type { Etag } from \"./etag\";\n\ntype EtagMatchType =\n | {\n type: \"match\";\n value: Etag[];\n }\n | {\n type: \"wildcard\";\n };\n\nclass EtagMatch {\n private constructor(private readonly etagMatch: EtagMatchType) {}\n\n static parse(etagMatch: string | undefined): EtagMatch | null {\n if (etagMatch === undefined) return null;\n if (etagMatch === \"*\") {\n return new EtagMatch({ type: \"wildcard\" });\n } else {\n return new EtagMatch({\n type: \"match\",\n value: etagMatch.split(\",\").map((etag) => etag.trim() as Etag),\n });\n }\n }\n\n matches(etag: Etag): boolean {\n switch (this.etagMatch.type) {\n case \"match\":\n return this.etagMatch.value.includes(etag);\n case \"wildcard\":\n return true;\n }\n }\n}\n\nclass DateMatch {\n private constructor(private readonly mtime: Date) {}\n\n static parse(dateMatch: string | undefined): DateMatch | null {\n if (dateMatch === undefined) return null;\n const time = Date.parse(dateMatch);\n if (isNaN(time)) return null;\n return new DateMatch(new Date(time));\n }\n\n matches(mtime: Date): boolean {\n return this.mtime.getTime() / 1_000 === mtime.getTime() / 1_000;\n }\n}\n\nexport class Options {\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#name-if-match>\n *\n * Examples:\n *\n * ```text\n * If-Match: \"xyzzy\"\n * If-Match: \"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"\n * If-Match: *\n * ```\n */\n private ifMatch: EtagMatch | null;\n\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>\n *\n * Examples:\n *\n * ```text\n * If-None-Match: \"xyzzy\"\n * If-None-Match: \"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"\n * If-None-Match: *\n * ```\n */\n private ifNoneMatch: EtagMatch | null;\n\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>\n *\n * Examples:\n *\n * ```text\n * If-Modified-Since: Mon, 07 Jan 2002 19:43:36 GMT\n * ```\n */\n private ifModifiedSince: DateMatch | null;\n\n /**\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>\n *\n * Examples:\n *\n * ```text\n * If-Unmodified-Since: Mon, 07 Jan 2002 19:43:36 GMT\n * ```\n */\n private ifUnmodifiedSince: DateMatch | null;\n\n constructor(request: IncomingMessage) {\n this.ifMatch = EtagMatch.parse(request.headers[\"if-match\"]);\n this.ifNoneMatch = EtagMatch.parse(request.headers[\"if-none-match\"]);\n this.ifModifiedSince = DateMatch.parse(request.headers[\"if-modified-since\"]);\n this.ifUnmodifiedSince = DateMatch.parse(request.headers[\"if-unmodified-since\"]);\n }\n\n /**\n * RFC 9110 section 13.1.1: If-Match precondition evaluation\n * RFC 9110 section 13.1.4: If-Unmodified-Since precondition evaluation\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.1>\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>\n */\n preconditionFailed(etag: Etag, mtime: Date): boolean {\n // If-Match precondition takes precedence\n if (this.ifMatch !== null && !this.ifMatch.matches(etag)) {\n return true;\n }\n\n // If-Unmodified-Since precondition (only if no If-Match header)\n if (this.ifMatch === null && this.ifUnmodifiedSince !== null) {\n return !this.ifUnmodifiedSince.matches(mtime);\n }\n\n return false;\n }\n\n /**\n * RFC 9110 section 13.1.2: If-None-Match precondition evaluation\n * RFC 9110 section 13.1.3: If-Modified-Since precondition evaluation\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>\n * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>\n */\n notModified(etag: Etag, mtime: Date): boolean {\n // If-None-Match takes precedence over If-Modified-Since\n if (this.ifNoneMatch !== null) {\n return this.ifNoneMatch.matches(etag);\n }\n\n // If-Modified-Since (only if no If-None-Match header)\n if (this.ifModifiedSince !== null) {\n return this.ifModifiedSince.matches(mtime);\n }\n\n return false;\n }\n}\n"],"mappings":";AAYA,IAAM,YAAN,MAAM,UAAU;CACd,YAAoB,WAA2C;AAA1B,OAAA,YAAA;;CAErC,OAAO,MAAM,WAAiD;AAC5D,MAAI,cAAc,KAAA,EAAW,QAAO;AACpC,MAAI,cAAc,IAChB,QAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;MAE1C,QAAO,IAAI,UAAU;GACnB,MAAM;GACN,OAAO,UAAU,MAAM,IAAI,CAAC,KAAK,SAAS,KAAK,MAAM,CAAS;GAC/D,CAAC;;CAIN,QAAQ,MAAqB;AAC3B,UAAQ,KAAK,UAAU,MAAvB;GACE,KAAK,QACH,QAAO,KAAK,UAAU,MAAM,SAAS,KAAK;GAC5C,KAAK,WACH,QAAO;;;;AAKf,IAAM,YAAN,MAAM,UAAU;CACd,YAAoB,OAA8B;AAAb,OAAA,QAAA;;CAErC,OAAO,MAAM,WAAiD;AAC5D,MAAI,cAAc,KAAA,EAAW,QAAO;EACpC,MAAM,OAAO,KAAK,MAAM,UAAU;AAClC,MAAI,MAAM,KAAK,CAAE,QAAO;AACxB,SAAO,IAAI,UAAU,IAAI,KAAK,KAAK,CAAC;;CAGtC,QAAQ,OAAsB;AAC5B,SAAO,KAAK,MAAM,SAAS,GAAG,QAAU,MAAM,SAAS,GAAG;;;AAI9D,IAAa,UAAb,MAAqB;;;;;;;;;;;;CAYnB;;;;;;;;;;;;CAaA;;;;;;;;;;CAWA;;;;;;;;;;CAWA;CAEA,YAAY,SAA0B;AACpC,OAAK,UAAU,UAAU,MAAM,QAAQ,QAAQ,YAAY;AAC3D,OAAK,cAAc,UAAU,MAAM,QAAQ,QAAQ,iBAAiB;AACpE,OAAK,kBAAkB,UAAU,MAAM,QAAQ,QAAQ,qBAAqB;AAC5E,OAAK,oBAAoB,UAAU,MAAM,QAAQ,QAAQ,uBAAuB;;;;;;;;CASlF,mBAAmB,MAAY,OAAsB;AAEnD,MAAI,KAAK,YAAY,QAAQ,CAAC,KAAK,QAAQ,QAAQ,KAAK,CACtD,QAAO;AAIT,MAAI,KAAK,YAAY,QAAQ,KAAK,sBAAsB,KACtD,QAAO,CAAC,KAAK,kBAAkB,QAAQ,MAAM;AAG/C,SAAO;;;;;;;;CAST,YAAY,MAAY,OAAsB;AAE5C,MAAI,KAAK,gBAAgB,KACvB,QAAO,KAAK,YAAY,QAAQ,KAAK;AAIvC,MAAI,KAAK,oBAAoB,KAC3B,QAAO,KAAK,gBAAgB,QAAQ,MAAM;AAG5C,SAAO"}
|