@atproto/oauth-provider 0.2.5 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/account/account-store.js +3 -3
  3. package/dist/account/account-store.js.map +1 -1
  4. package/dist/assets/app/bundle-manifest.json +2 -2
  5. package/dist/assets/app/main.js +3 -3
  6. package/dist/assets/app/main.js.map +1 -1
  7. package/dist/assets/asset.d.ts +0 -1
  8. package/dist/assets/asset.d.ts.map +1 -1
  9. package/dist/assets/assets-middleware.js +2 -3
  10. package/dist/assets/assets-middleware.js.map +1 -1
  11. package/dist/assets/index.js +2 -2
  12. package/dist/assets/index.js.map +1 -1
  13. package/dist/client/client-auth.js +2 -3
  14. package/dist/client/client-auth.js.map +1 -1
  15. package/dist/client/client-manager.d.ts +1 -1
  16. package/dist/client/client-manager.d.ts.map +1 -1
  17. package/dist/client/client-manager.js +3 -4
  18. package/dist/client/client-manager.js.map +1 -1
  19. package/dist/client/client-store.js +3 -4
  20. package/dist/client/client-store.js.map +1 -1
  21. package/dist/client/client-utils.d.ts +0 -1
  22. package/dist/client/client-utils.d.ts.map +1 -1
  23. package/dist/client/client-utils.js +2 -3
  24. package/dist/client/client-utils.js.map +1 -1
  25. package/dist/device/device-details.d.ts +0 -1
  26. package/dist/device/device-details.d.ts.map +1 -1
  27. package/dist/device/device-details.js +3 -3
  28. package/dist/device/device-details.js.map +1 -1
  29. package/dist/device/device-id.d.ts.map +1 -1
  30. package/dist/device/device-manager.d.ts +1 -2
  31. package/dist/device/device-manager.d.ts.map +1 -1
  32. package/dist/device/device-store.js +2 -3
  33. package/dist/device/device-store.js.map +1 -1
  34. package/dist/device/session-id.d.ts.map +1 -1
  35. package/dist/dpop/dpop-manager.d.ts +0 -1
  36. package/dist/dpop/dpop-manager.d.ts.map +1 -1
  37. package/dist/lib/html/build-document.d.ts +0 -1
  38. package/dist/lib/html/build-document.d.ts.map +1 -1
  39. package/dist/lib/html/escapers.js +4 -5
  40. package/dist/lib/html/escapers.js.map +1 -1
  41. package/dist/lib/html/util.js +2 -3
  42. package/dist/lib/html/util.js.map +1 -1
  43. package/dist/lib/http/accept.d.ts +1 -1
  44. package/dist/lib/http/accept.d.ts.map +1 -1
  45. package/dist/lib/http/accept.js +2 -2
  46. package/dist/lib/http/accept.js.map +1 -1
  47. package/dist/lib/http/context.js +1 -2
  48. package/dist/lib/http/context.js.map +1 -1
  49. package/dist/lib/http/method.d.ts +0 -1
  50. package/dist/lib/http/method.d.ts.map +1 -1
  51. package/dist/lib/http/method.js +1 -2
  52. package/dist/lib/http/method.js.map +1 -1
  53. package/dist/lib/http/middleware.d.ts +0 -1
  54. package/dist/lib/http/middleware.d.ts.map +1 -1
  55. package/dist/lib/http/middleware.js +5 -6
  56. package/dist/lib/http/middleware.js.map +1 -1
  57. package/dist/lib/http/parser.d.ts +2 -5
  58. package/dist/lib/http/parser.d.ts.map +1 -1
  59. package/dist/lib/http/parser.js +2 -2
  60. package/dist/lib/http/parser.js.map +1 -1
  61. package/dist/lib/http/path.js +1 -2
  62. package/dist/lib/http/path.js.map +1 -1
  63. package/dist/lib/http/request.d.ts +0 -1
  64. package/dist/lib/http/request.d.ts.map +1 -1
  65. package/dist/lib/http/request.js +9 -10
  66. package/dist/lib/http/request.js.map +1 -1
  67. package/dist/lib/http/response.d.ts +9 -8
  68. package/dist/lib/http/response.d.ts.map +1 -1
  69. package/dist/lib/http/response.js +24 -66
  70. package/dist/lib/http/response.js.map +1 -1
  71. package/dist/lib/http/route.d.ts +0 -1
  72. package/dist/lib/http/route.d.ts.map +1 -1
  73. package/dist/lib/http/route.js +1 -2
  74. package/dist/lib/http/route.js.map +1 -1
  75. package/dist/lib/http/router.d.ts +2 -4
  76. package/dist/lib/http/router.d.ts.map +1 -1
  77. package/dist/lib/http/stream.d.ts +2 -7
  78. package/dist/lib/http/stream.d.ts.map +1 -1
  79. package/dist/lib/http/stream.js +5 -5
  80. package/dist/lib/http/stream.js.map +1 -1
  81. package/dist/lib/http/types.d.ts +0 -1
  82. package/dist/lib/http/types.d.ts.map +1 -1
  83. package/dist/lib/http/url.d.ts +0 -1
  84. package/dist/lib/http/url.d.ts.map +1 -1
  85. package/dist/lib/http/url.js +1 -2
  86. package/dist/lib/http/url.js.map +1 -1
  87. package/dist/lib/redis.d.ts.map +1 -1
  88. package/dist/lib/redis.js +7 -6
  89. package/dist/lib/redis.js.map +1 -1
  90. package/dist/lib/util/cast.js +1 -2
  91. package/dist/lib/util/cast.js.map +1 -1
  92. package/dist/lib/util/crypto.js +2 -2
  93. package/dist/lib/util/crypto.js.map +1 -1
  94. package/dist/lib/util/date.js +2 -3
  95. package/dist/lib/util/date.js.map +1 -1
  96. package/dist/lib/util/hostname.d.ts +0 -1
  97. package/dist/lib/util/hostname.d.ts.map +1 -1
  98. package/dist/lib/util/hostname.js +4 -5
  99. package/dist/lib/util/hostname.js.map +1 -1
  100. package/dist/lib/util/redirect-uri.js +1 -2
  101. package/dist/lib/util/redirect-uri.js.map +1 -1
  102. package/dist/lib/util/time.js +1 -2
  103. package/dist/lib/util/time.js.map +1 -1
  104. package/dist/lib/util/well-known.d.ts +0 -1
  105. package/dist/lib/util/well-known.d.ts.map +1 -1
  106. package/dist/lib/util/well-known.js +1 -2
  107. package/dist/lib/util/well-known.js.map +1 -1
  108. package/dist/metadata/build-metadata.d.ts.map +1 -1
  109. package/dist/metadata/build-metadata.js +4 -4
  110. package/dist/metadata/build-metadata.js.map +1 -1
  111. package/dist/oauth-provider.d.ts +1 -2
  112. package/dist/oauth-provider.d.ts.map +1 -1
  113. package/dist/oauth-provider.js +19 -9
  114. package/dist/oauth-provider.js.map +1 -1
  115. package/dist/oauth-verifier.d.ts +1 -2
  116. package/dist/oauth-verifier.d.ts.map +1 -1
  117. package/dist/output/build-authorize-data.js +1 -2
  118. package/dist/output/build-authorize-data.js.map +1 -1
  119. package/dist/output/build-error-payload.js +2 -3
  120. package/dist/output/build-error-payload.js.map +1 -1
  121. package/dist/output/customization.d.ts +1 -1
  122. package/dist/output/customization.d.ts.map +1 -1
  123. package/dist/output/customization.js +3 -4
  124. package/dist/output/customization.js.map +1 -1
  125. package/dist/output/output-manager.d.ts +0 -1
  126. package/dist/output/output-manager.d.ts.map +1 -1
  127. package/dist/output/send-authorize-redirect.d.ts +0 -1
  128. package/dist/output/send-authorize-redirect.d.ts.map +1 -1
  129. package/dist/output/send-authorize-redirect.js +1 -2
  130. package/dist/output/send-authorize-redirect.js.map +1 -1
  131. package/dist/output/send-web-page.d.ts +3 -4
  132. package/dist/output/send-web-page.d.ts.map +1 -1
  133. package/dist/output/send-web-page.js +4 -5
  134. package/dist/output/send-web-page.js.map +1 -1
  135. package/dist/replay/replay-store-redis.d.ts +1 -1
  136. package/dist/replay/replay-store-redis.d.ts.map +1 -1
  137. package/dist/replay/replay-store.js +3 -4
  138. package/dist/replay/replay-store.js.map +1 -1
  139. package/dist/request/code.d.ts +1 -1
  140. package/dist/request/code.d.ts.map +1 -1
  141. package/dist/request/request-data.d.ts.map +1 -1
  142. package/dist/request/request-id.d.ts.map +1 -1
  143. package/dist/request/request-manager.d.ts.map +1 -1
  144. package/dist/request/request-manager.js +2 -1
  145. package/dist/request/request-manager.js.map +1 -1
  146. package/dist/request/request-store-redis.d.ts +1 -1
  147. package/dist/request/request-store-redis.d.ts.map +1 -1
  148. package/dist/request/request-store-redis.js.map +1 -1
  149. package/dist/request/request-store.js +2 -3
  150. package/dist/request/request-store.js.map +1 -1
  151. package/dist/request/request-uri.js +3 -3
  152. package/dist/request/request-uri.js.map +1 -1
  153. package/dist/signer/signed-token-payload.d.ts +90 -90
  154. package/dist/signer/signed-token-payload.d.ts.map +1 -1
  155. package/dist/signer/signer.d.ts +6 -6
  156. package/dist/signer/signer.d.ts.map +1 -1
  157. package/dist/token/refresh-token.d.ts +1 -1
  158. package/dist/token/refresh-token.d.ts.map +1 -1
  159. package/dist/token/token-claims.d.ts +90 -90
  160. package/dist/token/token-claims.d.ts.map +1 -1
  161. package/dist/token/token-id.d.ts +1 -1
  162. package/dist/token/token-id.d.ts.map +1 -1
  163. package/dist/token/token-store.js +2 -3
  164. package/dist/token/token-store.js.map +1 -1
  165. package/dist/token/verify-token-claims.js +1 -2
  166. package/dist/token/verify-token-claims.js.map +1 -1
  167. package/package.json +3 -7
  168. package/src/assets/assets-middleware.ts +1 -1
  169. package/src/client/client-manager.ts +3 -3
  170. package/src/lib/http/accept.ts +1 -0
  171. package/src/lib/http/middleware.ts +1 -1
  172. package/src/lib/http/response.ts +37 -78
  173. package/src/lib/http/stream.ts +4 -2
  174. package/src/lib/redis.ts +5 -3
  175. package/src/metadata/build-metadata.ts +6 -3
  176. package/src/oauth-provider.ts +19 -11
  177. package/src/oauth-verifier.ts +1 -1
  178. package/src/output/send-web-page.ts +5 -3
  179. package/src/replay/replay-store-redis.ts +1 -1
  180. package/src/request/request-manager.ts +4 -1
  181. package/src/request/request-store-redis.ts +2 -1
  182. package/tsconfig.backend.tsbuildinfo +1 -0
  183. package/tsconfig.frontend.tsbuildinfo +1 -0
  184. package/tsconfig.tools.tsbuildinfo +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../src/lib/http/method.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,aAAa,CAAA;AAC1E,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAA;AAE7D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,aAAa,CAY7E"}
1
+ {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../src/lib/http/method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,aAAa,CAAA;AAC1E,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAA;AAE7D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,aAAa,CAY7E"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMethodMatcher = void 0;
3
+ exports.createMethodMatcher = createMethodMatcher;
4
4
  function createMethodMatcher(method) {
5
5
  if (method === '*')
6
6
  return () => true;
@@ -15,5 +15,4 @@ function createMethodMatcher(method) {
15
15
  return () => false;
16
16
  return (req) => req.method != null && set.has(req.method);
17
17
  }
18
- exports.createMethodMatcher = createMethodMatcher;
19
18
  //# sourceMappingURL=method.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"method.js","sourceRoot":"","sources":["../../../src/lib/http/method.ts"],"names":[],"mappings":";;;AAKA,SAAgB,mBAAmB,CAAC,MAA0B;IAC5D,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAA;IACrC,IAAI,OAAO,MAAM,KAAK,UAAU;QAAE,OAAO,MAAM,CAAA;IAE/C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;QAC7B,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAA;IACvC,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;IAC/D,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAA;IACtC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAC3D,CAAC;AAZD,kDAYC"}
1
+ {"version":3,"file":"method.js","sourceRoot":"","sources":["../../../src/lib/http/method.ts"],"names":[],"mappings":";;AAKA,kDAYC;AAZD,SAAgB,mBAAmB,CAAC,MAA0B;IAC5D,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAA;IACrC,IAAI,OAAO,MAAM,KAAK,UAAU;QAAE,OAAO,MAAM,CAAA;IAE/C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;QAC7B,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAA;IACvC,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;IAC/D,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAA;IACtC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAC3D,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
2
  import { Middleware, Handler, NextFunction } from './types.js';
4
3
  export declare function combineMiddlewares<M extends Middleware<any, any, any>>(middlewares: Iterable<null | undefined | M>, options?: {
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/lib/http/middleware.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WA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E,MAAM,YAAY,CAAA;AAE9D,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpE,WAAW,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,GAAG,CAAC,CAAC,EAC3C,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACjC,CAAC,CAAA;AAwCJ,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IACvD,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,EAAE,MAAM,GAAG,CAAC,GAC/C,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GACpB,KAAK,CAAA;AAEX;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC3D,UAAU,EAAE,CAAC,EACb,OAAO,CAAC,EAAE,mBAAmB,GASxB,SAAS,CAAC,CAAC,CAAC,CAClB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,CAqBd;AA4CD,wBAAgB,IAAI,CAAC,CAAC,SAAS,YAAY,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAQvD"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.once = exports.createFinalHandler = exports.asHandler = exports.combineMiddlewares = void 0;
3
+ exports.combineMiddlewares = combineMiddlewares;
4
+ exports.asHandler = asHandler;
5
+ exports.createFinalHandler = createFinalHandler;
6
+ exports.once = once;
4
7
  const response_js_1 = require("./response.js");
5
8
  /**
6
9
  * Combine express/connect like middlewares (that can be async) into a single
@@ -38,7 +41,6 @@ function combineMiddlewares(middlewares, { skipKeyword } = {}) {
38
41
  nextMiddleware();
39
42
  };
40
43
  }
41
- exports.combineMiddlewares = combineMiddlewares;
42
44
  /**
43
45
  * Convert a middleware in a function that can be used as both a middleware and
44
46
  * and handler.
@@ -48,7 +50,6 @@ function asHandler(middleware, options) {
48
50
  return middleware.call(this, req, res, next);
49
51
  };
50
52
  }
51
- exports.asHandler = asHandler;
52
53
  function createFinalHandler(req, res, options) {
53
54
  return (err) => {
54
55
  if (err && (options?.debug ?? process.env['NODE_ENV'] === 'development')) {
@@ -64,10 +65,9 @@ function createFinalHandler(req, res, options) {
64
65
  const { status, ...payload } = buildFallbackPayload(req, err);
65
66
  res.setHeader('Content-Security-Policy', "default-src 'none'");
66
67
  res.setHeader('X-Content-Type-Options', 'nosniff');
67
- (0, response_js_1.writeJson)(res, payload, status);
68
+ (0, response_js_1.writeJson)(res, payload, { status });
68
69
  };
69
70
  }
70
- exports.createFinalHandler = createFinalHandler;
71
71
  function buildFallbackPayload(req, err) {
72
72
  const status = err ? getErrorStatusCode(err) : 404;
73
73
  const expose = getProp(err, 'expose', 'boolean') ?? status < 500;
@@ -106,7 +106,6 @@ function once(next) {
106
106
  return next(err);
107
107
  };
108
108
  }
109
- exports.once = once;
110
109
  function getProp(obj, key, type) {
111
110
  if (obj != null && typeof obj === 'object' && key in obj) {
112
111
  const value = obj[key];
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/lib/http/middleware.ts"],"names":[],"mappings":";;;AACA,+CAAyC;AAQzC;;;GAGG;AACH,SAAgB,kBAAkB,CAChC,WAA6D,EAC7D,EAAE,WAAW,KAA+B,EAAE;IAE9C,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CACrD,CAAC,CAAC,EAA8B,EAAE,CAAC,CAAC,IAA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,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,aAAa;YAC/D,CAAC,CAAC,GAAG,CAAC,KAAK;YACX,CAAC,CAAC,SAAS;KAChB,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAyB;IACnD,MAAM,MAAM,GACV,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;IAC1E,OAAO,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAA;AACvE,CAAC;AAED,SAAgB,IAAI,CAAyB,IAAO;IAClD,IAAI,YAAY,GAAa,IAAI,CAAA;IACjC,OAAO,UAAU,GAAG;QAClB,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;QAClE,MAAM,IAAI,GAAG,YAAY,CAAA;QACzB,YAAY,GAAG,IAAI,CAAA;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,CAAM,CAAA;AACR,CAAC;AAyBD,SAAS,OAAO,CAAC,GAAY,EAAE,GAAW,EAAE,IAAY;IACtD,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACzD,MAAM,KAAK,GAAI,GAA+B,CAAC,GAAG,CAAC,CAAA;QACnD,IAAI,OAAO,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAA;IACzC,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export type JsonScalar = string | number | boolean | null;
3
2
  export type Json = JsonScalar | Json[] | {
4
3
  [_ in string]?: Json;
@@ -27,14 +26,12 @@ export type ParserResult<P extends Parser> = ReturnType<P['parse']>;
27
26
  export type ParserForType<P extends Parser, T> = P extends Parser<infer U> ? (U extends T ? P : never) : never;
28
27
  export declare const parsers: [{
29
28
  readonly name: "json";
30
- readonly test: (mime: string) => mime is "application/json" | `application/${string}+json`;
29
+ readonly test: (mime: string) => mime is `application/json` | `application/${string}+json`;
31
30
  readonly parse: (buffer: Buffer, { charset }: ContentType) => Json;
32
31
  }, {
33
32
  readonly name: "urlencoded";
34
33
  readonly test: (mime: string) => mime is "application/x-www-form-urlencoded";
35
- readonly parse: (buffer: Buffer, { charset }: ContentType) => {
36
- [x: string]: string | undefined;
37
- };
34
+ readonly parse: (buffer: Buffer, { charset }: ContentType) => { [_ in string]?: string; };
38
35
  }, {
39
36
  readonly name: "bytes";
40
37
  readonly test: (mime: string) => mime is "application/octet-stream";
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/http/parser.ts"],"names":[],"mappings":";AAIA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AACzD,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG,IAAI,EAAE,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI;CAAE,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,CAiB3D;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,IAAI;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,CA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IAAI,IAAI,mCAAmC;kEAG3B,GAAG,CAAW,IAAN,MAAM,CAAC,CAAC,EAAE,MAAM,GAAE;;;qCAgB1C,IAAI,IAAI,0BAA0B;wCAG/B,MAAM;EAEE,CAAA;AAE7B,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAElD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;AAC5C,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA"}
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.parsers = exports.parseContentType = void 0;
6
+ exports.parsers = void 0;
7
+ exports.parseContentType = parseContentType;
7
8
  const bourne_1 = require("@hapi/bourne");
8
9
  const content_1 = require("@hapi/content");
9
10
  const http_errors_1 = __importDefault(require("http-errors"));
@@ -24,7 +25,6 @@ function parseContentType(type) {
24
25
  throw (0, http_errors_1.default)(415, err instanceof Error ? err.message : 'Invalid content-type');
25
26
  }
26
27
  }
27
- exports.parseContentType = parseContentType;
28
28
  exports.parsers = [
29
29
  {
30
30
  name: 'json',
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/lib/http/parser.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAiD;AACjD,2CAAuD;AACvD,8DAAyC;AAKzC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAa;IAC5C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAA,qBAAe,EACnB,GAAG,EACH,yBAAyB,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CACrE,CAAA;IACH,CAAC;IAED,IAAI,CAAC;QACH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,CAAC,MAAM;oBAAE,OAAO,EAAE,CAAA;gBAC7B,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;gBACrD,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;oBAAE,MAAM,IAAI,SAAS,CAAC,aAAa,CAAC,CAAA;gBAC/D,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;YACnC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,0BAA0B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;YACxE,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,CAAC,IAAI,EAAsC,EAAE;YACjD,OAAO,IAAI,KAAK,0BAA0B,CAAA;QAC5C,CAAC;QACD,KAAK,EAAE,CAAC,MAAM,EAAU,EAAE,CAAC,MAAM;KAClC;CAC0B,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPathMatcher = void 0;
3
+ exports.createPathMatcher = createPathMatcher;
4
4
  function createPathMatcher(refPath) {
5
5
  if (typeof refPath === 'string') {
6
6
  // Create a path matcher for a path with parameters (like /foo/:fooId/bar/:barId).
@@ -50,5 +50,4 @@ function createPathMatcher(refPath) {
50
50
  }
51
51
  return refPath;
52
52
  }
53
- exports.createPathMatcher = createPathMatcher;
54
53
  //# sourceMappingURL=path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/lib/http/path.ts"],"names":[],"mappings":";;;AAqBA,SAAgB,iBAAiB,CAC/B,OAAgB;IAEhB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,kFAAkF;QAClF,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B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
2
  import { UrlReference } from './url.js';
4
3
  export declare function validateHeaderValue(req: IncomingMessage, name: keyof IncomingMessage['headers'], allowedValues: readonly (string | null)[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/lib/http/request.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAY,YAAY,EAAE,MAAM,UAAU,CAAA;AAEjD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,MAAM,eAAe,CAAC,SAAS,CAAC,EACtC,aAAa,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,QAgB1C;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,SAAS,CACnB,IAAI,GACJ,UAAU,GACV,aAAa,GACb,SAAS,GACT,MAAM,CACT,EAAE,QAGJ;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,SAAS,CACnB,IAAI,GACJ,UAAU,GACV,OAAO,GACP,MAAM,GACN,OAAO,GACP,UAAU,GACV,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,cAAc,GACd,OAAO,GACP,QAAQ,GACR,MAAM,CACT,EAAE,QAGJ;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,SAAS,CACnB,IAAI,GACJ,aAAa,GACb,WAAW,GACX,YAAY,GACZ,MAAM,CACT,EAAE,QAGJ;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,YAAY,EACvB,SAAS,UAAQ,QAOlB;AAED,wBAAsB,cAAc,CAClC,GA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ACT,EAAE,QAGJ;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,SAAS,CACnB,IAAI,GACJ,aAAa,GACb,WAAW,GACX,YAAY,GACZ,MAAM,CACT,EAAE,QAGJ;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,YAAY,EACvB,SAAS,UAAQ,QAOlB;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,UAAU,SAAe,iBAa1B;AAGD,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,UAAO,QAMjB;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,SAAe,EACzB,WAAW,UAAQ,QAwBpB;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe,GACnB,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,CAM3C"}
@@ -3,7 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.parseHttpCookies = exports.validateCsrfToken = exports.validateSameOrigin = exports.setupCsrfToken = exports.validateReferer = exports.validateFetchSite = exports.validateFetchDest = exports.validateFetchMode = exports.validateHeaderValue = void 0;
6
+ exports.validateHeaderValue = validateHeaderValue;
7
+ exports.validateFetchMode = validateFetchMode;
8
+ exports.validateFetchDest = validateFetchDest;
9
+ exports.validateFetchSite = validateFetchSite;
10
+ exports.validateReferer = validateReferer;
11
+ exports.setupCsrfToken = setupCsrfToken;
12
+ exports.validateSameOrigin = validateSameOrigin;
13
+ exports.validateCsrfToken = validateCsrfToken;
14
+ exports.parseHttpCookies = parseHttpCookies;
7
15
  const cookie_1 = require("cookie");
8
16
  const crypto_1 = require("crypto");
9
17
  const http_errors_1 = __importDefault(require("http-errors"));
@@ -20,19 +28,15 @@ function validateHeaderValue(req, name, allowedValues) {
20
28
  : `Missing ${name} header`);
21
29
  }
22
30
  }
23
- exports.validateHeaderValue = validateHeaderValue;
24
31
  function validateFetchMode(req, res, expectedMode) {
25
32
  validateHeaderValue(req, 'sec-fetch-mode', expectedMode);
26
33
  }
27
- exports.validateFetchMode = validateFetchMode;
28
34
  function validateFetchDest(req, res, expectedDest) {
29
35
  validateHeaderValue(req, 'sec-fetch-dest', expectedDest);
30
36
  }
31
- exports.validateFetchDest = validateFetchDest;
32
37
  function validateFetchSite(req, res, expectedSite) {
33
38
  validateHeaderValue(req, 'sec-fetch-site', expectedSite);
34
39
  }
35
- exports.validateFetchSite = validateFetchSite;
36
40
  function validateReferer(req, res, reference, allowNull = false) {
37
41
  const referer = req.headers['referer'];
38
42
  const refererUrl = referer ? new URL(referer) : null;
@@ -40,7 +44,6 @@ function validateReferer(req, res, reference, allowNull = false) {
40
44
  throw (0, http_errors_1.default)(400, `Invalid referer ${referer}`);
41
45
  }
42
46
  }
43
- exports.validateReferer = validateReferer;
44
47
  async function setupCsrfToken(req, res, cookieName = 'csrf_token') {
45
48
  const csrfToken = (0, crypto_1.randomBytes)(8).toString('hex');
46
49
  (0, response_js_1.appendHeader)(res, 'Set-Cookie', (0, cookie_1.serialize)(cookieName, csrfToken, {
@@ -50,7 +53,6 @@ async function setupCsrfToken(req, res, cookieName = 'csrf_token') {
50
53
  path: req.url?.split('?', 1)[0] || '/',
51
54
  }));
52
55
  }
53
- exports.setupCsrfToken = setupCsrfToken;
54
56
  // CORS ensure not cross origin
55
57
  function validateSameOrigin(req, res, origin, allowNull = true) {
56
58
  const reqOrigin = req.headers['origin'];
@@ -58,7 +60,6 @@ function validateSameOrigin(req, res, origin, allowNull = true) {
58
60
  throw (0, http_errors_1.default)(400, `Invalid origin ${reqOrigin}`);
59
61
  }
60
62
  }
61
- exports.validateSameOrigin = validateSameOrigin;
62
63
  function validateCsrfToken(req, res, csrfToken, cookieName = 'csrf_token', clearCookie = false) {
63
64
  const cookies = parseHttpCookies(req);
64
65
  if (!csrfToken ||
@@ -76,7 +77,6 @@ function validateCsrfToken(req, res, csrfToken, cookieName = 'csrf_token', clear
76
77
  }));
77
78
  }
78
79
  }
79
- exports.validateCsrfToken = validateCsrfToken;
80
80
  function parseHttpCookies(req) {
81
81
  return 'cookies' in req && req.cookies // Already parsed by another middleware
82
82
  ? req.cookies
@@ -84,5 +84,4 @@ function parseHttpCookies(req) {
84
84
  ? (req.cookies = (0, cookie_1.parse)(req.headers['cookie']))
85
85
  : null;
86
86
  }
87
- exports.parseHttpCookies = parseHttpCookies;
88
87
  //# sourceMappingURL=request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/lib/http/request.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA2E;AAC3E,mCAAoC;AACpC,8DAAyC;AAEzC,+CAA4C;AAE5C,qCAAiD;AAEjD,SAAgB,mBAAmB,CACjC,GAAoB,EACpB,IAAsC,EACtC,aAAyC;IAEzC,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;IAEvC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,WAAW,IAAI,SAAS,CAAC,CAAA;IACtD,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAA,qBAAe,EACnB,GAAG,EACH,KAAK;YACH,CAAC,CAAC,aAAa,IAAI,YAAY,KAAK,eAAe,aAAa,GAAG;YACnE,CAAC,CAAC,WAAW,I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G,CAAC,OAAe;QACtB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;YACrB,CAAC,CAAC,CAAE,GAAW,CAAC,OAAO,GAAG,IAAA,cAAW,EAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC,IAAI,CAAA;AACZ,CAAC"}
@@ -1,13 +1,14 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import { Readable } from 'node:stream';
5
2
  import { Handler, ServerResponse } from './types.js';
6
3
  export declare function appendHeader(res: ServerResponse, header: string, value: string | readonly string[]): void;
7
4
  export declare function writeRedirect(res: ServerResponse, url: string, status?: number): void;
8
- export declare function writeStream(res: ServerResponse, stream: Readable, contentType?: string, status?: number): Promise<void>;
9
- export declare function writeBuffer(res: ServerResponse, buffer: Buffer, contentType?: string, status?: number): Promise<void>;
10
- export declare function writeJson(res: ServerResponse, payload: unknown, status?: number, contentType?: string): Promise<void>;
11
- export declare function staticJsonHandler(value: unknown, contentType?: string, status?: number): Handler<unknown>;
12
- export declare function writeHtml(res: ServerResponse, html: Buffer | string, status?: number, contentType?: string): Promise<void>;
5
+ export type WriteResponseOptions = {
6
+ status?: number;
7
+ contentType?: string;
8
+ };
9
+ export declare function writeStream(res: ServerResponse, stream: Readable, { status, contentType, }?: WriteResponseOptions): void;
10
+ export declare function writeBuffer(res: ServerResponse, chunk: string | Buffer, { status, contentType, }?: WriteResponseOptions): void;
11
+ export declare function writeJson(res: ServerResponse, payload: unknown, { contentType, ...options }?: WriteResponseOptions): void;
12
+ export declare function staticJsonMiddleware(value: unknown, { contentType, ...options }?: WriteResponseOptions): Handler<unknown>;
13
+ export declare function writeHtml(res: ServerResponse, html: Buffer | string, { contentType, ...options }?: WriteResponseOptions): void;
13
14
  //# sourceMappingURL=response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/lib/http/response.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAe,QAAQ,EAAa,MAAM,aAAa,CAAA;AAI9D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEpD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAChC,IAAI,CAQN;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,EACX,MAAM,SAAM,GACX,IAAI,CAEN;AA2BD,wBAAsB,WAAW,CAC/B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,QAAQ,EAChB,WAAW,SACiB,EAC5B,MAAM,SAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,SAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,OAAO,EAChB,MAAM,SAAM,EACZ,WAAW,SAAqB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,WAAW,SAAqB,EAChC,MAAM,SAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,MAAM,SAAM,EACZ,WAAW,SAAc,GACxB,OAAO,CAAC,IAAI,CAAC,CAGf"}
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/lib/http/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,aAAa,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEpD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAChC,IAAI,CAQN;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,EACX,MAAM,SAAM,GACX,IAAI,CAEN;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,QAAQ,EAChB,EACE,MAAY,EACZ,WAAwC,GACzC,GAAE,oBAAyB,GAC3B,IAAI,CAYN;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,EACE,MAAY,EACZ,WAAwC,GACzC,GAAE,oBAAyB,GAC3B,IAAI,CAIN;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,OAAO,EAChB,EAAE,WAAgC,EAAE,GAAG,OAAO,EAAE,GAAE,oBAAyB,GAC1E,IAAI,CAGN;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,EAAE,WAAgC,EAAE,GAAG,OAAO,EAAE,GAAE,oBAAyB,GAC1E,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,EAAE,WAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,oBAAyB,GACnE,IAAI,CAEN"}
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeHtml = exports.staticJsonHandler = exports.writeJson = exports.writeBuffer = exports.writeStream = exports.writeRedirect = exports.appendHeader = void 0;
3
+ exports.appendHeader = appendHeader;
4
+ exports.writeRedirect = writeRedirect;
5
+ exports.writeStream = writeStream;
6
+ exports.writeBuffer = writeBuffer;
7
+ exports.writeJson = writeJson;
8
+ exports.staticJsonMiddleware = staticJsonMiddleware;
9
+ exports.writeHtml = writeHtml;
4
10
  const node_stream_1 = require("node:stream");
5
- const promises_1 = require("node:stream/promises");
6
- const node_zlib_1 = require("node:zlib");
7
11
  function appendHeader(res, header, value) {
8
12
  const existing = res.getHeader(header);
9
13
  if (existing == null) {
@@ -14,85 +18,39 @@ function appendHeader(res, header, value) {
14
18
  res.setHeader(header, arr.concat(value));
15
19
  }
16
20
  }
17
- exports.appendHeader = appendHeader;
18
21
  function writeRedirect(res, url, status = 302) {
19
22
  res.writeHead(status, { Location: url }).end();
20
23
  }
21
- exports.writeRedirect = writeRedirect;
22
- function negotiateEncoding(accept) {
23
- if (accept?.includes('br'))
24
- return 'br';
25
- if (accept?.includes('gzip'))
26
- return 'gzip';
27
- return 'identity';
28
- }
29
- function getEncoder(encoding) {
30
- switch (encoding) {
31
- case 'br':
32
- return (0, node_zlib_1.createBrotliCompress)({
33
- // Default quality is too slow
34
- params: { [node_zlib_1.constants.BROTLI_PARAM_QUALITY]: 5 },
35
- });
36
- case 'gzip':
37
- return (0, node_zlib_1.createGzip)();
38
- case 'identity':
39
- return new node_stream_1.PassThrough();
40
- default:
41
- throw new Error(`Unsupported encoding: ${encoding}`);
42
- }
43
- }
44
- const ifString = (value) => typeof value === 'string' ? value : undefined;
45
- async function writeStream(res, stream, contentType = ifString(stream.headers?.['content-type']) ||
46
- 'application/octet-stream', status = 200) {
24
+ function writeStream(res, stream, { status = 200, contentType = 'application/octet-stream', } = {}) {
47
25
  res.statusCode = status;
48
26
  res.setHeader('content-type', contentType);
49
- appendHeader(res, 'vary', 'accept-encoding');
50
- const encoding = negotiateEncoding(res.req.headers['accept-encoding']);
51
- res.setHeader('content-encoding', encoding);
52
- res.setHeader('transfer-encoding', 'chunked');
53
27
  if (res.req.method === 'HEAD') {
54
28
  res.end();
55
29
  stream.destroy();
56
- return;
57
- }
58
- try {
59
- await (0, promises_1.pipeline)(stream, getEncoder(encoding), res);
60
30
  }
61
- catch (err) {
62
- // Prevent the socket from being left open in a bad state
63
- res.socket?.destroy();
64
- if (err != null && typeof err === 'object') {
65
- // If an abort signal is used, we can consider this function's job successful
66
- if ('name' in err && err.name === 'AbortError')
67
- return;
68
- // If the client closes the connection, we don't care about the error
69
- if ('code' in err && err.code === 'ERR_STREAM_PREMATURE_CLOSE')
70
- return;
71
- }
72
- throw err;
31
+ else {
32
+ (0, node_stream_1.pipeline)([stream, res], (_err) => {
33
+ // The error will be propagated through the streams
34
+ });
73
35
  }
74
36
  }
75
- exports.writeStream = writeStream;
76
- async function writeBuffer(res, buffer, contentType, status = 200) {
77
- const stream = node_stream_1.Readable.from([buffer]);
78
- return writeStream(res, stream, contentType, status);
37
+ function writeBuffer(res, chunk, { status = 200, contentType = 'application/octet-stream', } = {}) {
38
+ res.statusCode = status;
39
+ res.setHeader('content-type', contentType);
40
+ res.end(chunk);
79
41
  }
80
- exports.writeBuffer = writeBuffer;
81
- async function writeJson(res, payload, status = 200, contentType = 'application/json') {
42
+ function writeJson(res, payload, { contentType = 'application/json', ...options } = {}) {
82
43
  const buffer = Buffer.from(JSON.stringify(payload));
83
- return writeBuffer(res, buffer, contentType, status);
44
+ writeBuffer(res, buffer, { ...options, contentType });
84
45
  }
85
- exports.writeJson = writeJson;
86
- function staticJsonHandler(value, contentType = 'application/json', status = 200) {
46
+ function staticJsonMiddleware(value, { contentType = 'application/json', ...options } = {}) {
87
47
  const buffer = Buffer.from(JSON.stringify(value));
88
- return function (req, res, next) {
89
- void writeBuffer(res, buffer, contentType, status).catch(next);
48
+ const staticOptions = { ...options, contentType };
49
+ return function (req, res) {
50
+ writeBuffer(res, buffer, staticOptions);
90
51
  };
91
52
  }
92
- exports.staticJsonHandler = staticJsonHandler;
93
- async function writeHtml(res, html, status = 200, contentType = 'text/html') {
94
- const buffer = Buffer.isBuffer(html) ? html : Buffer.from(html);
95
- return writeBuffer(res, buffer, contentType, status);
53
+ function writeHtml(res, html, { contentType = 'text/html', ...options } = {}) {
54
+ writeBuffer(res, html, { ...options, contentType });
96
55
  }
97
- exports.writeHtml = writeHtml;
98
56
  //# sourceMappingURL=response.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/lib/http/response.ts"],"names":[],"mappings":";;;AAAA,6CAA8D;AAC9D,mDAA+C;AAC/C,yCAAuE;AAIvE,SAAgB,YAAY,CAC1B,GAAmB,EACnB,MAAc,EACd,KAAiC;IAEjC,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IACtC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACrB,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC9B,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;QACnE,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC;AAZD,oCAYC;AAED,SAAgB,aAAa,CAC3B,GAAmB,EACnB,GAAW,EACX,MAAM,GAAG,GAAG;IAEZ,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAA;AAChD,CAAC;AAND,sCAMC;AAED,SAAS,iBAAiB,CAAC,MAA0B;IACnD,IAAI,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACvC,IAAI,MAAM,EAAE,Q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CACvB,GAAmB,EACnB,OAAgB,EAChB,EAAE,WAAW,GAAG,kBAAkB,EAAE,GAAG,OAAO,KAA2B,EAAE;IAE3E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;AACvD,CAAC;AAED,SAAgB,oBAAoB,CAClC,KAAc,EACd,EAAE,WAAW,GAAG,kBAAkB,EAAE,GAAG,OAAO,KAA2B,EAAE;IAE3E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IACjD,MAAM,aAAa,GAAyB,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,CAAA;IACvE,OAAO,UAAU,GAAG,EAAE,GAAG;QACvB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;IACzC,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,SAAS,CACvB,GAAmB,EACnB,IAAqB,EACrB,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,OAAO,KAA2B,EAAE;IAEpE,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;AACrD,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { SubCtx } from './context.js';
3
2
  import { MethodMatcherInput } from './method.js';
4
3
  import { Params, Path } from './path.js';
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/lib/http/route.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAuB,MAAM,aAAa,CAAA;AAErE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAqB,M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C,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAAA;AAC9E,MAAM,MAAM,eAAe,CACzB,CAAC,EACD,CAAC,SAAS,MAAM,EAChB,GAAG,GAAG,eAAe,EACrB,GAAG,GAAG,cAAc,IAClB,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAExC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,CAAC,SAAS,MAAM,EAChB,CAAC,GAAG,IAAI,EACR,GAAG,SAAS,eAAe,GAAG,eAAe,EAC7C,GAAG,SAAS,cAAc,GAAG,cAAc,EAE3C,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GACvC,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAkBzB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRoute = void 0;
3
+ exports.createRoute = createRoute;
4
4
  const context_js_1 = require("./context.js");
5
5
  const method_js_1 = require("./method.js");
6
6
  const middleware_js_1 = require("./middleware.js");
@@ -35,5 +35,4 @@ function createRoute(method, path, ...mw) {
35
35
  return next();
36
36
  };
37
37
  }
38
- exports.createRoute = createRoute;
39
38
  //# sourceMappingURL=route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/lib/http/route.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,2CAAqE;AACrE,mDAAoD;AACpD,uCAA2D;AAW3D;;;;;;;;;;;;;GAaG;AACH,SAAgB,WAAW,CAMzB,MAA0B,EAC1B,IAAa,EACb,GAAG,EAAqC;IAExC,MAAM,aAAa,GAAG,IA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;IAEnE,OAAO,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QAC7B,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAA;YAC9C,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;YACtC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,OAAO,GAAG,IAAA,mBAAM,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;gBAC9C,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;YACjD,CAAC;QACH,CAAC;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { SubCtx } from './context.js';
4
2
  import { MethodMatcherInput } from './method.js';
5
3
  import { Params, Path } from './path.js';
@@ -14,9 +12,9 @@ export declare class Router<T = void, Req extends IncomingMessage = IncomingMess
14
12
  private readonly middlewares;
15
13
  constructor(url?: {
16
14
  /** Used to build the origin of the {@link RouterCtx['url']} context property */
17
- protocol?: string | undefined;
15
+ protocol?: string;
18
16
  /** Used to build the origin of the {@link RouterCtx['url']} context property */
19
- host?: string | undefined;
17
+ host?: string;
20
18
  } | undefined);
21
19
  use(...middlewares: RouterMiddleware<T, Req, Res>[]): this;
22
20
  all<P extends Params = Params>(path: Path<P>, ...mw: RouteMiddleware<RouterCtx<T>, P, Req, Res>[]): this;
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/lib/http/router.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,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CAAC,CAAC,EACb,GAAG,EAAE,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IAKrD,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,GAAG,EAAE,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IAKrD;;OAEG;IACH,YAAY;CA2Cb"}
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import { IncomingMessage } from 'node:http';
5
2
  import { Readable } from 'node:stream';
6
3
  import { KnownNames, ParserResult } from './parser.js';
@@ -13,16 +10,14 @@ export declare function decodeHttpRequest(req: IncomingMessage): Readable;
13
10
  */
14
11
  export declare function parseHttpRequest<A extends readonly KnownNames[]>(req: IncomingMessage, allow: A): Promise<ParserResult<Extract<{
15
12
  readonly name: "json";
16
- readonly test: (mime: string) => mime is "application/json" | `application/${string}+json`;
13
+ readonly test: (mime: string) => mime is `application/json` | `application/${string}+json`;
17
14
  readonly parse: (buffer: Buffer, { charset }: import("./parser.js").ContentType) => import("./parser.js").Json;
18
15
  }, {
19
16
  name: A[number];
20
17
  }> | Extract<{
21
18
  readonly name: "urlencoded";
22
19
  readonly test: (mime: string) => mime is "application/x-www-form-urlencoded";
23
- readonly parse: (buffer: Buffer, { charset }: import("./parser.js").ContentType) => {
24
- [x: string]: string | undefined;
25
- };
20
+ readonly parse: (buffer: Buffer, { charset }: import("./parser.js").ContentType) => { [_ in string]?: string; };
26
21
  }, {
27
22
  name: A[number];
28
23
  }> | Extract<{
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/http/stream.ts"],"names":[],"mappings":";;;AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,UAAU,EAGV,YAAY,EAEb,MAAM,aAAa,CAAA;AAEpB,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG,QAAQ,CAMhE;AAED;;;;;GAKG;AAEH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,EACpE,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,CAAC;;;;;UAiBuB,CAAC,CAAC,MAAM,CAAC;;;;;;;;UAAT,CAAC,CAAC,MAAM,CAAC;;;;;;UAAT,CAAC,CAAC,MAAM,CAAC;KAEzC"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/http/stream.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,UAAU,EAGV,YAAY,EAEb,MAAM,aAAa,CAAA;AAEpB,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG,QAAQ,CAQhE;AAED;;;;;GAKG;AAEH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,EACpE,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,CAAC;;;;;UAiBuB,CAAC,CAAC,MAAM,CAAC;;;;uGAGmrB,CAAC;;UAH7rB,CAAC,CAAC,MAAM,CAAC;;;;;;UAAT,CAAC,CAAC,MAAM,CAAC;KAEzC"}