@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 +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"],"names":[],"mappings":"AAGA,MAAM,sBAAsB,GAAG,wBAAwB;AAEjD,SAAU,kBAAkB,CAChC,OAAwB,EAAA;AAExB,IAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG;IACvB,IAAI,GAAG,KAAK,SAAS;AAAE,QAAA,OAAO,IAAI;IAElC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,sBAAsB,CAAC;AAC/C,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,IAAI;AAEvB,IAAA,OAAO,KAAK,CAAC,CAAC,CAAmC;AACnD;;;;"}
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"}
@@ -1,29 +1,36 @@
1
- 'use strict';
2
-
1
+ //#region src/utils/headers.ts
3
2
  /** HTTP header names used in the parquet server handler */
4
3
  const HeaderName = {
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
- ETag: "etag",
14
- LastModified: "last-modified",
15
- WWWAuthenticate: "www-authenticate",
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
- AcceptRanges: "bytes",
20
- Allow: "GET, HEAD",
21
- CacheControl: "public, immutable, max-age=31536000",
22
- Connection: "close",
23
- ContentType: "application/octet-stream",
24
- WWWAuthenticate: 'Bearer realm="parquet-server"',
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
- //# sourceMappingURL=headers.cjs.map
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"],"names":[],"mappings":";;AAAA;AACO,MAAM,UAAU,GAAG;AACxB,IACA,YAAY,EAAE,eAAe;AAC7B,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,aAAa,EAAE,gBAAgB;AAC/B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,WAAW,EAAE,cAAc;AAC3B,IACA,IAAI,EAAE,MAAM;AACZ,IAIA,YAAY,EAAE,eAAe;AAC7B,IACA,eAAe,EAAE,kBAAkB;;AAGrC;AACO,MAAM,WAAW,GAAG;AACzB,IAAA,YAAY,EAAE,OAAO;AACrB,IAAA,KAAK,EAAE,WAAW;AAClB,IAAA,YAAY,EAAE,qCAAqC;AACnD,IAAA,UAAU,EAAE,OAAO;AACnB,IAAA,WAAW,EAAE,0BAA0B;AACvC,IAAA,eAAe,EAAE,+BAA+B;;;;;;"}
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"}
@@ -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
- AcceptRanges: "accept-ranges",
4
- Allow: "allow",
5
- Authorization: "authorization",
6
- CacheControl: "cache-control",
7
- Connection: "connection",
8
- ContentLength: "content-length",
9
- ContentRange: "content-range",
10
- ContentType: "content-type",
11
- ETag: "etag",
12
- LastModified: "last-modified",
13
- WWWAuthenticate: "www-authenticate",
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
- AcceptRanges: "bytes",
18
- Allow: "GET, HEAD",
19
- CacheControl: "public, immutable, max-age=31536000",
20
- Connection: "close",
21
- ContentType: "application/octet-stream",
22
- WWWAuthenticate: 'Bearer realm="parquet-server"',
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
- //# sourceMappingURL=headers.js.map
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"],"names":[],"mappings":"AAAA;AACO,MAAM,UAAU,GAAG;AACxB,IACA,YAAY,EAAE,eAAe;AAC7B,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,aAAa,EAAE,gBAAgB;AAC/B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,WAAW,EAAE,cAAc;AAC3B,IACA,IAAI,EAAE,MAAM;AACZ,IAIA,YAAY,EAAE,eAAe;AAC7B,IACA,eAAe,EAAE,kBAAkB;;AAGrC;AACO,MAAM,WAAW,GAAG;AACzB,IAAA,YAAY,EAAE,OAAO;AACrB,IAAA,KAAK,EAAE,WAAW;AAClB,IAAA,YAAY,EAAE,qCAAqC;AACnD,IAAA,UAAU,EAAE,OAAO;AACnB,IAAA,WAAW,EAAE,0BAA0B;AACvC,IAAA,eAAe,EAAE,+BAA+B;;;;;"}
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"}
@@ -1,16 +1,16 @@
1
- 'use strict';
2
-
1
+ //#region src/utils/method.ts
3
2
  function isGetOrHead(method) {
4
- return method === "GET" || method === "HEAD";
3
+ return method === "GET" || method === "HEAD";
5
4
  }
6
5
  function isGet(method) {
7
- return method === "GET";
6
+ return method === "GET";
8
7
  }
9
8
  function isHead(method) {
10
- return method === "HEAD";
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
- //# sourceMappingURL=method.cjs.map
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"],"names":[],"mappings":";;AAGM,SAAU,WAAW,CACzB,MAAqC,EAAA;AAErC,IAAA,OAAO,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM;AAC9C;AAEM,SAAU,KAAK,CACnB,MAAiC,EAAA;IAEjC,OAAO,MAAM,KAAK,KAAK;AACzB;AAEM,SAAU,MAAM,CACpB,MAAiC,EAAA;IAEjC,OAAO,MAAM,KAAK,MAAM;AAC1B;;;;;;"}
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"}
@@ -1,12 +1,14 @@
1
+ //#region src/utils/method.ts
1
2
  function isGetOrHead(method) {
2
- return method === "GET" || method === "HEAD";
3
+ return method === "GET" || method === "HEAD";
3
4
  }
4
5
  function isGet(method) {
5
- return method === "GET";
6
+ return method === "GET";
6
7
  }
7
8
  function isHead(method) {
8
- return method === "HEAD";
9
+ return method === "HEAD";
9
10
  }
10
-
11
+ //#endregion
11
12
  export { isGet, isGetOrHead, isHead };
12
- //# sourceMappingURL=method.js.map
13
+
14
+ //# sourceMappingURL=method.js.map
@@ -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"],"names":[],"mappings":"AAGM,SAAU,WAAW,CACzB,MAAqC,EAAA;AAErC,IAAA,OAAO,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM;AAC9C;AAEM,SAAU,KAAK,CACnB,MAAiC,EAAA;IAEjC,OAAO,MAAM,KAAK,KAAK;AACzB;AAEM,SAAU,MAAM,CACpB,MAAiC,EAAA;IAEjC,OAAO,MAAM,KAAK,MAAM;AAC1B;;;;"}
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"}
@@ -1,135 +1,112 @@
1
- 'use strict';
2
-
3
- class EtagMatch {
4
- etagMatch;
5
- constructor(etagMatch) {
6
- this.etagMatch = etagMatch;
7
- }
8
- static parse(etagMatch) {
9
- if (etagMatch === undefined)
10
- return null;
11
- if (etagMatch === "*") {
12
- return new EtagMatch({ type: "wildcard" });
13
- }
14
- else {
15
- return new EtagMatch({
16
- type: "match",
17
- value: etagMatch.split(",").map((etag) => etag.trim()),
18
- });
19
- }
20
- }
21
- matches(etag) {
22
- switch (this.etagMatch.type) {
23
- case "match":
24
- return this.etagMatch.value.includes(etag);
25
- case "wildcard":
26
- return true;
27
- }
28
- }
29
- }
30
- class DateMatch {
31
- mtime;
32
- constructor(mtime) {
33
- this.mtime = mtime;
34
- }
35
- static parse(dateMatch) {
36
- if (dateMatch === undefined)
37
- return null;
38
- const time = Date.parse(dateMatch);
39
- if (isNaN(time))
40
- return null;
41
- return new DateMatch(new Date(time));
42
- }
43
- matches(mtime) {
44
- return this.mtime.getTime() / 1_000 === mtime.getTime() / 1_000;
45
- }
46
- }
47
- class Options {
48
- /**
49
- * See <https://datatracker.ietf.org/doc/html/rfc9110#name-if-match>
50
- *
51
- * Examples:
52
- *
53
- * ```text
54
- * If-Match: "xyzzy"
55
- * If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
56
- * If-Match: *
57
- * ```
58
- */
59
- ifMatch;
60
- /**
61
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.2>
62
- *
63
- * Examples:
64
- *
65
- * ```text
66
- * If-None-Match: "xyzzy"
67
- * If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
68
- * If-None-Match: *
69
- * ```
70
- */
71
- ifNoneMatch;
72
- /**
73
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.3>
74
- *
75
- * Examples:
76
- *
77
- * ```text
78
- * If-Modified-Since: Mon, 07 Jan 2002 19:43:36 GMT
79
- * ```
80
- */
81
- ifModifiedSince;
82
- /**
83
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>
84
- *
85
- * Examples:
86
- *
87
- * ```text
88
- * If-Unmodified-Since: Mon, 07 Jan 2002 19:43:36 GMT
89
- * ```
90
- */
91
- ifUnmodifiedSince;
92
- constructor(request) {
93
- this.ifMatch = EtagMatch.parse(request.headers["if-match"]);
94
- this.ifNoneMatch = EtagMatch.parse(request.headers["if-none-match"]);
95
- this.ifModifiedSince = DateMatch.parse(request.headers["if-modified-since"]);
96
- this.ifUnmodifiedSince = DateMatch.parse(request.headers["if-unmodified-since"]);
97
- }
98
- /**
99
- * RFC 9110 section 13.1.1: If-Match precondition evaluation
100
- * RFC 9110 section 13.1.4: If-Unmodified-Since precondition evaluation
101
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.1>
102
- * See <https://datatracker.ietf.org/doc/html/rfc9110#section-13.1.4>
103
- */
104
- preconditionFailed(etag, mtime) {
105
- // If-Match precondition takes precedence
106
- if (this.ifMatch !== null && !this.ifMatch.matches(etag)) {
107
- return true;
108
- }
109
- // If-Unmodified-Since precondition (only if no If-Match header)
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
- //# sourceMappingURL=options.cjs.map
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"],"names":[],"mappings":";;AAYA,MAAM,SAAS,CAAA;AACwB,IAAA,SAAA;AAArC,IAAA,WAAA,CAAq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OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;QACvC;;AAGA,QAAA,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE;YACjC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC;QAC5C;AAEA,QAAA,OAAO,KAAK;IACd;AACD;;;;"}
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,MAA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