@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.
Files changed (82) hide show
  1. package/dist/export.cjs +16 -17
  2. package/dist/export.cjs.map +1 -1
  3. package/dist/export.d.ts +6 -2
  4. package/dist/export.d.ts.map +1 -1
  5. package/dist/export.js +16 -15
  6. package/dist/export.js.map +1 -1
  7. package/dist/fs-store.cjs +83 -87
  8. package/dist/fs-store.cjs.map +1 -1
  9. package/dist/fs-store.d.ts +14 -10
  10. package/dist/fs-store.d.ts.map +1 -1
  11. package/dist/fs-store.js +83 -85
  12. package/dist/fs-store.js.map +1 -1
  13. package/dist/handler.cjs +132 -157
  14. package/dist/handler.cjs.map +1 -1
  15. package/dist/handler.d.ts +8 -4
  16. package/dist/handler.d.ts.map +1 -1
  17. package/dist/handler.js +132 -155
  18. package/dist/handler.js.map +1 -1
  19. package/dist/index.cjs +13 -18
  20. package/dist/index.d.ts +6 -6
  21. package/dist/index.js +6 -6
  22. package/dist/parquet-server.cjs +95 -101
  23. package/dist/parquet-server.cjs.map +1 -1
  24. package/dist/parquet-server.d.ts +16 -12
  25. package/dist/parquet-server.d.ts.map +1 -1
  26. package/dist/parquet-server.js +95 -98
  27. package/dist/parquet-server.js.map +1 -1
  28. package/dist/serve.cjs +98 -94
  29. package/dist/serve.cjs.map +1 -1
  30. package/dist/serve.d.ts +11 -2
  31. package/dist/serve.d.ts.map +1 -1
  32. package/dist/serve.js +98 -92
  33. package/dist/serve.js.map +1 -1
  34. package/dist/utils/etag.cjs +5 -7
  35. package/dist/utils/etag.cjs.map +1 -1
  36. package/dist/utils/etag.js +5 -5
  37. package/dist/utils/etag.js.map +1 -1
  38. package/dist/utils/filename.cjs +9 -11
  39. package/dist/utils/filename.cjs.map +1 -1
  40. package/dist/utils/filename.js +9 -9
  41. package/dist/utils/filename.js.map +1 -1
  42. package/dist/utils/headers.cjs +28 -21
  43. package/dist/utils/headers.cjs.map +1 -1
  44. package/dist/utils/headers.js +28 -19
  45. package/dist/utils/headers.js.map +1 -1
  46. package/dist/utils/method.cjs +7 -7
  47. package/dist/utils/method.cjs.map +1 -1
  48. package/dist/utils/method.js +7 -5
  49. package/dist/utils/method.js.map +1 -1
  50. package/dist/utils/options.cjs +111 -134
  51. package/dist/utils/options.cjs.map +1 -1
  52. package/dist/utils/options.js +111 -132
  53. package/dist/utils/options.js.map +1 -1
  54. package/dist/utils/range.cjs +26 -31
  55. package/dist/utils/range.cjs.map +1 -1
  56. package/dist/utils/range.js +26 -29
  57. package/dist/utils/range.js.map +1 -1
  58. package/dist/utils/status.cjs +17 -17
  59. package/dist/utils/status.cjs.map +1 -1
  60. package/dist/utils/status.js +17 -15
  61. package/dist/utils/status.js.map +1 -1
  62. package/package.json +4 -4
  63. package/src/parquet-server.ts +16 -2
  64. package/dist/index.cjs.map +0 -1
  65. package/dist/index.d.ts.map +0 -1
  66. package/dist/index.js.map +0 -1
  67. package/dist/utils/etag.d.ts +0 -15
  68. package/dist/utils/etag.d.ts.map +0 -1
  69. package/dist/utils/filename.d.ts +0 -4
  70. package/dist/utils/filename.d.ts.map +0 -1
  71. package/dist/utils/headers.d.ts +0 -31
  72. package/dist/utils/headers.d.ts.map +0 -1
  73. package/dist/utils/index.d.ts +0 -8
  74. package/dist/utils/index.d.ts.map +0 -1
  75. package/dist/utils/method.d.ts +0 -6
  76. package/dist/utils/method.d.ts.map +0 -1
  77. package/dist/utils/options.d.ts +0 -64
  78. package/dist/utils/options.d.ts.map +0 -1
  79. package/dist/utils/range.d.ts +0 -4
  80. package/dist/utils/range.d.ts.map +0 -1
  81. package/dist/utils/status.d.ts +0 -17
  82. package/dist/utils/status.d.ts.map +0 -1
@@ -1,133 +1,112 @@
1
- class EtagMatch {
2
- etagMatch;
3
- constructor(etagMatch) {
4
- this.etagMatch = etagMatch;
5
- }
6
- static parse(etagMatch) {
7
- if (etagMatch === undefined)
8
- return null;
9
- if (etagMatch === "*") {
10
- return new EtagMatch({ type: "wildcard" });
11
- }
12
- else {
13
- return new EtagMatch({
14
- type: "match",
15
- value: etagMatch.split(",").map((etag) => etag.trim()),
16
- });
17
- }
18
- }
19
- matches(etag) {
20
- switch (this.etagMatch.type) {
21
- case "match":
22
- return this.etagMatch.value.includes(etag);
23
- case "wildcard":
24
- return true;
25
- }
26
- }
27
- }
28
- class DateMatch {
29
- mtime;
30
- constructor(mtime) {
31
- this.mtime = mtime;
32
- }
33
- static parse(dateMatch) {
34
- if (dateMatch === undefined)
35
- return null;
36
- const time = Date.parse(dateMatch);
37
- if (isNaN(time))
38
- return null;
39
- return new DateMatch(new Date(time));
40
- }
41
- matches(mtime) {
42
- return this.mtime.getTime() / 1_000 === mtime.getTime() / 1_000;
43
- }
44
- }
45
- class Options {
46
- /**
47
- * See <https://datatracker.ietf.org/doc/html/rfc9110#name-if-match>
48
- *
49
- * Examples:
50
- *
51
- * ```text
52
- * If-Match: "xyzzy"
53
- * If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
54
- * If-Match: *
55
- * ```
56
- */
57
- ifMatch;
58
- /**
59
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>
60
- *
61
- * Examples:
62
- *
63
- * ```text
64
- * If-None-Match: "xyzzy"
65
- * If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
66
- * If-None-Match: *
67
- * ```
68
- */
69
- ifNoneMatch;
70
- /**
71
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>
72
- *
73
- * Examples:
74
- *
75
- * ```text
76
- * If-Modified-Since: Mon, 07 Jan 2002 19:43:36 GMT
77
- * ```
78
- */
79
- ifModifiedSince;
80
- /**
81
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>
82
- *
83
- * Examples:
84
- *
85
- * ```text
86
- * If-Unmodified-Since: Mon, 07 Jan 2002 19:43:36 GMT
87
- * ```
88
- */
89
- ifUnmodifiedSince;
90
- constructor(request) {
91
- this.ifMatch = EtagMatch.parse(request.headers["if-match"]);
92
- this.ifNoneMatch = EtagMatch.parse(request.headers["if-none-match"]);
93
- this.ifModifiedSince = DateMatch.parse(request.headers["if-modified-since"]);
94
- this.ifUnmodifiedSince = DateMatch.parse(request.headers["if-unmodified-since"]);
95
- }
96
- /**
97
- * RFC 9110 section 13.1.1: If-Match precondition evaluation
98
- * RFC 9110 section 13.1.4: If-Unmodified-Since precondition evaluation
99
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.1>
100
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>
101
- */
102
- preconditionFailed(etag, mtime) {
103
- // If-Match precondition takes precedence
104
- if (this.ifMatch !== null && !this.ifMatch.matches(etag)) {
105
- return true;
106
- }
107
- // If-Unmodified-Since precondition (only if no If-Match header)
108
- if (this.ifMatch === null && this.ifUnmodifiedSince !== null) {
109
- return !this.ifUnmodifiedSince.matches(mtime);
110
- }
111
- return false;
112
- }
113
- /**
114
- * RFC 9110 section 13.1.2: If-None-Match precondition evaluation
115
- * RFC 9110 section 13.1.3: If-Modified-Since precondition evaluation
116
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>
117
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>
118
- */
119
- notModified(etag, mtime) {
120
- // If-None-Match takes precedence over If-Modified-Since
121
- if (this.ifNoneMatch !== null) {
122
- return this.ifNoneMatch.matches(etag);
123
- }
124
- // If-Modified-Since (only if no If-None-Match header)
125
- if (this.ifModifiedSince !== null) {
126
- return this.ifModifiedSince.matches(mtime);
127
- }
128
- return false;
129
- }
130
- }
131
-
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
132
110
  export { Options };
133
- //# sourceMappingURL=options.js.map
111
+
112
+ //# sourceMappingURL=options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","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"],"names":[],"mappings":"AAYA,MAAM,SAAS,CAAA;AACwB,IAAA,SAAA;AAArC,IAAA,WAAA,CAAqC,SAAwB,EAAA;QAAxB,IAAA,CAAA,SAAS,GAAT,SAAS;IAAkB;IAEhE,OAAO,KAAK,CAAC,SAA6B,EAAA;QACxC,IAAI,SAAS,KAAK,SAAS;AAAE,YAAA,OAAO,IAAI;AACxC,QAAA,IAAI,SAAS,KAAK,GAAG,EAAE;YACrB,OAAO,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,UAAU,EAA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ources":["../../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,Y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AC,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"}
@@ -1,34 +1,29 @@
1
- 'use strict';
2
-
1
+ //#region src/utils/range.ts
3
2
  function parseRange(request) {
4
- const range = request.headers["range"];
5
- if (range === undefined)
6
- return undefined;
7
- const match = range.match(/^bytes=(\d*)-(\d*)$/);
8
- if (!match)
9
- return null;
10
- const [, startStr, endStr] = match;
11
- const start = startStr ? parseInt(startStr, 10) : null;
12
- const end = endStr ? parseInt(endStr, 10) : null;
13
- if ((start !== null && (isNaN(start) || start < 0)) ||
14
- (end !== null && (isNaN(end) || end < 0)) ||
15
- (start !== null && end !== null && start > end))
16
- return null;
17
- // Both start and end are specified - bounded range
18
- if (start !== null && end !== null) {
19
- return { type: "bounded", start, end };
20
- }
21
- // Only start is specified - offset range (e.g., bytes=500-)
22
- if (start !== null && end === null) {
23
- return { type: "offset", offset: start };
24
- }
25
- // Only end is specified - suffix range (e.g., bytes=-500)
26
- if (start === null && end !== null) {
27
- return { type: "suffix", suffix: end };
28
- }
29
- // Neither start nor end specified (bytes=-) - invalid
30
- return null;
3
+ const range = request.headers["range"];
4
+ if (range === void 0) return void 0;
5
+ const match = range.match(/^bytes=(\d*)-(\d*)$/);
6
+ if (!match) return null;
7
+ const [, startStr, endStr] = match;
8
+ const start = startStr ? parseInt(startStr, 10) : null;
9
+ const end = endStr ? parseInt(endStr, 10) : null;
10
+ if (start !== null && (isNaN(start) || start < 0) || end !== null && (isNaN(end) || end < 0) || start !== null && end !== null && start > end) return null;
11
+ if (start !== null && end !== null) return {
12
+ type: "bounded",
13
+ start,
14
+ end
15
+ };
16
+ if (start !== null && end === null) return {
17
+ type: "offset",
18
+ offset: start
19
+ };
20
+ if (start === null && end !== null) return {
21
+ type: "suffix",
22
+ suffix: end
23
+ };
24
+ return null;
31
25
  }
32
-
26
+ //#endregion
33
27
  exports.parseRange = parseRange;
34
- //# sourceMappingURL=range.cjs.map
28
+
29
+ //# sourceMappingURL=range.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"range.cjs","sources":["../../src/utils/range.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingMessage } from \"node:http\";\n\nexport function parseRange(request: IncomingMessage): PFrameInternal.HttpRange | null | undefined {\n const range = request.headers[\"range\"];\n if (range === undefined) return undefined;\n\n const match = range.match(/^bytes=(\\d*)-(\\d*)$/);\n if (!match) return null;\n\n const [, startStr, endStr] = match;\n const start = startStr ? parseInt(startStr, 10) : null;\n const end = endStr ? parseInt(endStr, 10) : null;\n if (\n (start !== null && (isNaN(start) || start < 0)) ||\n (end !== null && (isNaN(end) || end < 0)) ||\n (start !== null && end !== null && start > end)\n )\n return null;\n\n // Both start and end are specified - bounded range\n if (start !== null && end !== null) {\n return { type: \"bounded\", start, end };\n }\n\n // Only start is specified - offset range (e.g., bytes=500-)\n if (start !== null && end === null) {\n return { type: \"offset\", offset: start };\n }\n\n // Only end is specified - suffix range (e.g., bytes=-500)\n if (start === null && end !== null) {\n return { type: \"suffix\", suffix: end };\n }\n\n // Neither start nor end specified (bytes=-) - invalid\n return null;\n}\n"],"names":[],"mappings":";;AAGM,SAAU,UAAU,CAAC,OAAwB,EAAA;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;IACtC,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IAEzC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC;AAChD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,IAAI;IAEvB,MAAM,GAAG,QAAQ,EAAE,MAAM,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,IAAI;AACtD,IAAA,MAAM,GAAG,GAAG,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI;AAChD,IAAA,IACE,CAAC,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AAC9C,SAAC,GAAG,KAAK,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;SACxC,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC;AAE/C,QAAA,OAAO,IAAI;;IAGb,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;IACxC;;IAGA,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE;IAC1C;;IAGA,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;IACxC;;AAGA,IAAA,OAAO,IAAI;AACb;;;;"}
1
+ {"version":3,"file":"range.cjs","names":[],"sources":["../../src/utils/range.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingMessage } from \"node:http\";\n\nexport function parseRange(request: IncomingMessage): PFrameInternal.HttpRange | null | undefined {\n const range = request.headers[\"range\"];\n if (range === undefined) return undefined;\n\n const match = range.match(/^bytes=(\\d*)-(\\d*)$/);\n if (!match) return null;\n\n const [, startStr, endStr] = match;\n const start = startStr ? parseInt(startStr, 10) : null;\n const end = endStr ? parseInt(endStr, 10) : null;\n if (\n (start !== null && (isNaN(start) || start < 0)) ||\n (end !== null && (isNaN(end) || end < 0)) ||\n (start !== null && end !== null && start > end)\n )\n return null;\n\n // Both start and end are specified - bounded range\n if (start !== null && end !== null) {\n return { type: \"bounded\", start, end };\n }\n\n // Only start is specified - offset range (e.g., bytes=500-)\n if (start !== null && end === null) {\n return { type: \"offset\", offset: start };\n }\n\n // Only end is specified - suffix range (e.g., bytes=-500)\n if (start === null && end !== null) {\n return { type: \"suffix\", suffix: end };\n }\n\n // Neither start nor end specified (bytes=-) - invalid\n return null;\n}\n"],"mappings":";AAGA,SAAgB,WAAW,SAAuE;CAChG,MAAM,QAAQ,QAAQ,QAAQ;AAC9B,KAAI,UAAU,KAAA,EAAW,QAAO,KAAA;CAEhC,MAAM,QAAQ,MAAM,MAAM,sBAAsB;AAChD,KAAI,CAAC,MAAO,QAAO;CAEnB,MAAM,GAAG,UAAU,UAAU;CAC7B,MAAM,QAAQ,WAAW,SAAS,UAAU,GAAG,GAAG;CAClD,MAAM,MAAM,SAAS,SAAS,QAAQ,GAAG,GAAG;AAC5C,KACG,UAAU,SAAS,MAAM,MAAM,IAAI,QAAQ,MAC3C,QAAQ,SAAS,MAAM,IAAI,IAAI,MAAM,MACrC,UAAU,QAAQ,QAAQ,QAAQ,QAAQ,IAE3C,QAAO;AAGT,KAAI,UAAU,QAAQ,QAAQ,KAC5B,QAAO;EAAE,MAAM;EAAW;EAAO;EAAK;AAIxC,KAAI,UAAU,QAAQ,QAAQ,KAC5B,QAAO;EAAE,MAAM;EAAU,QAAQ;EAAO;AAI1C,KAAI,UAAU,QAAQ,QAAQ,KAC5B,QAAO;EAAE,MAAM;EAAU,QAAQ;EAAK;AAIxC,QAAO"}
@@ -1,32 +1,29 @@
1
+ //#region src/utils/range.ts
1
2
  function parseRange(request) {
2
- const range = request.headers["range"];
3
- if (range === undefined)
4
- return undefined;
5
- const match = range.match(/^bytes=(\d*)-(\d*)$/);
6
- if (!match)
7
- return null;
8
- const [, startStr, endStr] = match;
9
- const start = startStr ? parseInt(startStr, 10) : null;
10
- const end = endStr ? parseInt(endStr, 10) : null;
11
- if ((start !== null && (isNaN(start) || start < 0)) ||
12
- (end !== null && (isNaN(end) || end < 0)) ||
13
- (start !== null && end !== null && start > end))
14
- return null;
15
- // Both start and end are specified - bounded range
16
- if (start !== null && end !== null) {
17
- return { type: "bounded", start, end };
18
- }
19
- // Only start is specified - offset range (e.g., bytes=500-)
20
- if (start !== null && end === null) {
21
- return { type: "offset", offset: start };
22
- }
23
- // Only end is specified - suffix range (e.g., bytes=-500)
24
- if (start === null && end !== null) {
25
- return { type: "suffix", suffix: end };
26
- }
27
- // Neither start nor end specified (bytes=-) - invalid
28
- return null;
3
+ const range = request.headers["range"];
4
+ if (range === void 0) return void 0;
5
+ const match = range.match(/^bytes=(\d*)-(\d*)$/);
6
+ if (!match) return null;
7
+ const [, startStr, endStr] = match;
8
+ const start = startStr ? parseInt(startStr, 10) : null;
9
+ const end = endStr ? parseInt(endStr, 10) : null;
10
+ if (start !== null && (isNaN(start) || start < 0) || end !== null && (isNaN(end) || end < 0) || start !== null && end !== null && start > end) return null;
11
+ if (start !== null && end !== null) return {
12
+ type: "bounded",
13
+ start,
14
+ end
15
+ };
16
+ if (start !== null && end === null) return {
17
+ type: "offset",
18
+ offset: start
19
+ };
20
+ if (start === null && end !== null) return {
21
+ type: "suffix",
22
+ suffix: end
23
+ };
24
+ return null;
29
25
  }
30
-
26
+ //#endregion
31
27
  export { parseRange };
32
- //# sourceMappingURL=range.js.map
28
+
29
+ //# sourceMappingURL=range.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"range.js","sources":["../../src/utils/range.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingMessage } from \"node:http\";\n\nexport function parseRange(request: IncomingMessage): PFrameInternal.HttpRange | null | undefined {\n const range = request.headers[\"range\"];\n if (range === undefined) return undefined;\n\n const match = range.match(/^bytes=(\\d*)-(\\d*)$/);\n if (!match) return null;\n\n const [, startStr, endStr] = match;\n const start = startStr ? parseInt(startStr, 10) : null;\n const end = endStr ? parseInt(endStr, 10) : null;\n if (\n (start !== null && (isNaN(start) || start < 0)) ||\n (end !== null && (isNaN(end) || end < 0)) ||\n (start !== null && end !== null && start > end)\n )\n return null;\n\n // Both start and end are specified - bounded range\n if (start !== null && end !== null) {\n return { type: \"bounded\", start, end };\n }\n\n // Only start is specified - offset range (e.g., bytes=500-)\n if (start !== null && end === null) {\n return { type: \"offset\", offset: start };\n }\n\n // Only end is specified - suffix range (e.g., bytes=-500)\n if (start === null && end !== null) {\n return { type: \"suffix\", suffix: end };\n }\n\n // Neither start nor end specified (bytes=-) - invalid\n return null;\n}\n"],"names":[],"mappings":"AAGM,SAAU,UAAU,CAAC,OAAwB,EAAA;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;IACtC,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IAEzC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC;AAChD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,IAAI;IAEvB,MAAM,GAAG,QAAQ,EAAE,MAAM,CAAC,GAAG,KAAK;AAClC,IAAA,MAAM,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,IAAI;AACtD,IAAA,MAAM,GAAG,GAAG,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI;AAChD,IAAA,IACE,CAAC,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AAC9C,SAAC,GAAG,KAAK,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;SACxC,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC;AAE/C,QAAA,OAAO,IAAI;;IAGb,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;IACxC;;IAGA,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE;IAC1C;;IAGA,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAClC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;IACxC;;AAGA,IAAA,OAAO,IAAI;AACb;;;;"}
1
+ {"version":3,"file":"range.js","names":[],"sources":["../../src/utils/range.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type { IncomingMessage } from \"node:http\";\n\nexport function parseRange(request: IncomingMessage): PFrameInternal.HttpRange | null | undefined {\n const range = request.headers[\"range\"];\n if (range === undefined) return undefined;\n\n const match = range.match(/^bytes=(\\d*)-(\\d*)$/);\n if (!match) return null;\n\n const [, startStr, endStr] = match;\n const start = startStr ? parseInt(startStr, 10) : null;\n const end = endStr ? parseInt(endStr, 10) : null;\n if (\n (start !== null && (isNaN(start) || start < 0)) ||\n (end !== null && (isNaN(end) || end < 0)) ||\n (start !== null && end !== null && start > end)\n )\n return null;\n\n // Both start and end are specified - bounded range\n if (start !== null && end !== null) {\n return { type: \"bounded\", start, end };\n }\n\n // Only start is specified - offset range (e.g., bytes=500-)\n if (start !== null && end === null) {\n return { type: \"offset\", offset: start };\n }\n\n // Only end is specified - suffix range (e.g., bytes=-500)\n if (start === null && end !== null) {\n return { type: \"suffix\", suffix: end };\n }\n\n // Neither start nor end specified (bytes=-) - invalid\n return null;\n}\n"],"mappings":";AAGA,SAAgB,WAAW,SAAuE;CAChG,MAAM,QAAQ,QAAQ,QAAQ;AAC9B,KAAI,UAAU,KAAA,EAAW,QAAO,KAAA;CAEhC,MAAM,QAAQ,MAAM,MAAM,sBAAsB;AAChD,KAAI,CAAC,MAAO,QAAO;CAEnB,MAAM,GAAG,UAAU,UAAU;CAC7B,MAAM,QAAQ,WAAW,SAAS,UAAU,GAAG,GAAG;CAClD,MAAM,MAAM,SAAS,SAAS,QAAQ,GAAG,GAAG;AAC5C,KACG,UAAU,SAAS,MAAM,MAAM,IAAI,QAAQ,MAC3C,QAAQ,SAAS,MAAM,IAAI,IAAI,MAAM,MACrC,UAAU,QAAQ,QAAQ,QAAQ,QAAQ,IAE3C,QAAO;AAGT,KAAI,UAAU,QAAQ,QAAQ,KAC5B,QAAO;EAAE,MAAM;EAAW;EAAO;EAAK;AAIxC,KAAI,UAAU,QAAQ,QAAQ,KAC5B,QAAO;EAAE,MAAM;EAAU,QAAQ;EAAO;AAI1C,KAAI,UAAU,QAAQ,QAAQ,KAC5B,QAAO;EAAE,MAAM;EAAU,QAAQ;EAAK;AAIxC,QAAO"}
@@ -1,21 +1,21 @@
1
- 'use strict';
2
-
1
+ //#region src/utils/status.ts
3
2
  /** HTTP status codes used in the parquet server handler */
4
3
  const StatusCode = {
5
- Ok: 200, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200>
6
- PartialContent: 206, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206>
7
- NotModified: 304, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304>
8
- BadRequest: 400, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400>
9
- Unauthorized: 401, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401>
10
- NotFound: 404, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404>
11
- MethodNotAllowed: 405, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405>
12
- RequestTimeout: 408, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408>
13
- Gone: 410, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410>
14
- PreconditionFailed: 412, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412>
15
- RangeNotSatisfiable: 416, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416>
16
- InternalServerError: 500, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500>
17
- GatewayTimeout: 504, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504>
4
+ Ok: 200,
5
+ PartialContent: 206,
6
+ NotModified: 304,
7
+ BadRequest: 400,
8
+ Unauthorized: 401,
9
+ NotFound: 404,
10
+ MethodNotAllowed: 405,
11
+ RequestTimeout: 408,
12
+ Gone: 410,
13
+ PreconditionFailed: 412,
14
+ RangeNotSatisfiable: 416,
15
+ InternalServerError: 500,
16
+ GatewayTimeout: 504
18
17
  };
19
-
18
+ //#endregion
20
19
  exports.StatusCode = StatusCode;
21
- //# sourceMappingURL=status.cjs.map
20
+
21
+ //# sourceMappingURL=status.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"status.cjs","sources":["../../src/utils/status.ts"],"sourcesContent":["/** HTTP status codes used in the parquet server handler */\nexport const StatusCode = {\n Ok: 200, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200>\n PartialContent: 206, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206>\n NotModified: 304, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304>\n BadRequest: 400, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400>\n Unauthorized: 401, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401>\n NotFound: 404, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404>\n MethodNotAllowed: 405, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405>\n RequestTimeout: 408, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408>\n Gone: 410, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410>\n PreconditionFailed: 412, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412>\n RangeNotSatisfiable: 416, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416>\n InternalServerError: 500, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500>\n GatewayTimeout: 504, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504>\n} as const;\n"],"names":[],"mappings":";;AAAA;AACO,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE,GAAG;IACP,cAAc,EAAE,GAAG;IACnB,WAAW,EAAE,GAAG;IAChB,UAAU,EAAE,GAAG;IACf,YAAY,EAAE,GAAG;IACjB,QAAQ,EAAE,GAAG;IACb,gBAAgB,EAAE,GAAG;IACrB,cAAc,EAAE,GAAG;IACnB,IAAI,EAAE,GAAG;IACT,kBAAkB,EAAE,GAAG;IACvB,mBAAmB,EAAE,GAAG;IACxB,mBAAmB,EAAE,GAAG;IACxB,cAAc,EAAE,GAAG;;;;;"}
1
+ {"version":3,"file":"status.cjs","names":[],"sources":["../../src/utils/status.ts"],"sourcesContent":["/** HTTP status codes used in the parquet server handler */\nexport const StatusCode = {\n Ok: 200, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200>\n PartialContent: 206, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206>\n NotModified: 304, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304>\n BadRequest: 400, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400>\n Unauthorized: 401, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401>\n NotFound: 404, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404>\n MethodNotAllowed: 405, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405>\n RequestTimeout: 408, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408>\n Gone: 410, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410>\n PreconditionFailed: 412, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412>\n RangeNotSatisfiable: 416, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416>\n InternalServerError: 500, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500>\n GatewayTimeout: 504, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504>\n} as const;\n"],"mappings":";;AACA,MAAa,aAAa;CACxB,IAAI;CACJ,gBAAgB;CAChB,aAAa;CACb,YAAY;CACZ,cAAc;CACd,UAAU;CACV,kBAAkB;CAClB,gBAAgB;CAChB,MAAM;CACN,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,gBAAgB;CACjB"}
@@ -1,19 +1,21 @@
1
+ //#region src/utils/status.ts
1
2
  /** HTTP status codes used in the parquet server handler */
2
3
  const StatusCode = {
3
- Ok: 200, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200>
4
- PartialContent: 206, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206>
5
- NotModified: 304, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304>
6
- BadRequest: 400, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400>
7
- Unauthorized: 401, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401>
8
- NotFound: 404, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404>
9
- MethodNotAllowed: 405, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405>
10
- RequestTimeout: 408, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408>
11
- Gone: 410, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410>
12
- PreconditionFailed: 412, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412>
13
- RangeNotSatisfiable: 416, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416>
14
- InternalServerError: 500, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500>
15
- GatewayTimeout: 504, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504>
4
+ Ok: 200,
5
+ PartialContent: 206,
6
+ NotModified: 304,
7
+ BadRequest: 400,
8
+ Unauthorized: 401,
9
+ NotFound: 404,
10
+ MethodNotAllowed: 405,
11
+ RequestTimeout: 408,
12
+ Gone: 410,
13
+ PreconditionFailed: 412,
14
+ RangeNotSatisfiable: 416,
15
+ InternalServerError: 500,
16
+ GatewayTimeout: 504
16
17
  };
17
-
18
+ //#endregion
18
19
  export { StatusCode };
19
- //# sourceMappingURL=status.js.map
20
+
21
+ //# sourceMappingURL=status.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sources":["../../src/utils/status.ts"],"sourcesContent":["/** HTTP status codes used in the parquet server handler */\nexport const StatusCode = {\n Ok: 200, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200>\n PartialContent: 206, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206>\n NotModified: 304, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304>\n BadRequest: 400, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400>\n Unauthorized: 401, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401>\n NotFound: 404, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404>\n MethodNotAllowed: 405, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405>\n RequestTimeout: 408, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408>\n Gone: 410, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410>\n PreconditionFailed: 412, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412>\n RangeNotSatisfiable: 416, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416>\n InternalServerError: 500, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500>\n GatewayTimeout: 504, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504>\n} as const;\n"],"names":[],"mappings":"AAAA;AACO,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE,GAAG;IACP,cAAc,EAAE,GAAG;IACnB,WAAW,EAAE,GAAG;IAChB,UAAU,EAAE,GAAG;IACf,YAAY,EAAE,GAAG;IACjB,QAAQ,EAAE,GAAG;IACb,gBAAgB,EAAE,GAAG;IACrB,cAAc,EAAE,GAAG;IACnB,IAAI,EAAE,GAAG;IACT,kBAAkB,EAAE,GAAG;IACvB,mBAAmB,EAAE,GAAG;IACxB,mBAAmB,EAAE,GAAG;IACxB,cAAc,EAAE,GAAG;;;;;"}
1
+ {"version":3,"file":"status.js","names":[],"sources":["../../src/utils/status.ts"],"sourcesContent":["/** HTTP status codes used in the parquet server handler */\nexport const StatusCode = {\n Ok: 200, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200>\n PartialContent: 206, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206>\n NotModified: 304, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304>\n BadRequest: 400, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400>\n Unauthorized: 401, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401>\n NotFound: 404, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404>\n MethodNotAllowed: 405, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405>\n RequestTimeout: 408, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408>\n Gone: 410, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410>\n PreconditionFailed: 412, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412>\n RangeNotSatisfiable: 416, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416>\n InternalServerError: 500, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500>\n GatewayTimeout: 504, // <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504>\n} as const;\n"],"mappings":";;AACA,MAAa,aAAa;CACxB,IAAI;CACJ,gBAAgB;CAChB,aAAa;CACb,YAAY;CACZ,cAAc;CACd,UAAU;CACV,kBAAkB;CAClB,gBAAgB;CAChB,MAAM;CACN,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,gBAAgB;CACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pframes-rs-serv",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "PFrames - Node.js HTTP(S) Parquet Server",
5
5
  "keywords": [
6
6
  "http",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@datadog/pprof": "5.13.3",
48
- "@milaboratories/ts-builder": "1.2.11",
48
+ "@milaboratories/ts-builder": "1.3.2",
49
49
  "@milaboratories/ts-configs": "1.2.1",
50
50
  "@types/autocannon": "7.12.7",
51
51
  "@types/node": "22.19.13",
@@ -53,8 +53,8 @@
53
53
  "autocannon": "8.0.0",
54
54
  "rimraf": "6.1.3",
55
55
  "tslib": "2.8.1",
56
- "typescript": "5.9.3",
57
- "undici": "7.22.0",
56
+ "typescript": "6.0.2",
57
+ "undici": "8.1.0",
58
58
  "vitest": "4.0.18"
59
59
  },
60
60
  "scripts": {
@@ -130,13 +130,27 @@ export class ParquetServer implements Disposable {
130
130
  ...(options?.port ? [Options.Port, options.port.toString()] : []),
131
131
  ],
132
132
  {
133
- stdio: ["ignore", "pipe", "ignore"],
133
+ stdio: ["ignore", "pipe", "inherit"],
134
134
  },
135
135
  );
136
136
 
137
137
  const lineReader = createInterface({ input: serverProcess.stdout! });
138
138
 
139
- const firstLine = await lineReader[Symbol.asyncIterator]().next();
139
+ const exitPromise = new Promise<never>((_, reject) => {
140
+ serverProcess.once("exit", (code, signal) => {
141
+ reject(
142
+ new Error(
143
+ `parquet-server exited before emitting server info (code=${code}, signal=${signal})`,
144
+ ),
145
+ );
146
+ });
147
+ serverProcess.once("error", reject);
148
+ });
149
+
150
+ const firstLine = await Promise.race([lineReader[Symbol.asyncIterator]().next(), exitPromise]);
151
+ if (firstLine.value === undefined) {
152
+ throw new Error("parquet-server stdout closed without emitting server info");
153
+ }
140
154
  const serverInfo = parseJson(firstLine.value as Info);
141
155
 
142
156
  lineReader.on("line", console.log);
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}