@atproto/oauth-provider 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. package/CHANGELOG.md +15 -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 +1 -2
  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 +0 -1
  44. package/dist/lib/http/accept.d.ts.map +1 -1
  45. package/dist/lib/http/accept.js +1 -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 +4 -5
  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 +0 -3
  68. package/dist/lib/http/response.d.ts.map +1 -1
  69. package/dist/lib/http/response.js +7 -8
  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-verifier.d.ts +1 -2
  114. package/dist/oauth-verifier.d.ts.map +1 -1
  115. package/dist/output/build-authorize-data.js +1 -2
  116. package/dist/output/build-authorize-data.js.map +1 -1
  117. package/dist/output/build-error-payload.js +2 -3
  118. package/dist/output/build-error-payload.js.map +1 -1
  119. package/dist/output/customization.d.ts +1 -1
  120. package/dist/output/customization.d.ts.map +1 -1
  121. package/dist/output/customization.js +3 -4
  122. package/dist/output/customization.js.map +1 -1
  123. package/dist/output/output-manager.d.ts +0 -1
  124. package/dist/output/output-manager.d.ts.map +1 -1
  125. package/dist/output/send-authorize-redirect.d.ts +0 -1
  126. package/dist/output/send-authorize-redirect.d.ts.map +1 -1
  127. package/dist/output/send-authorize-redirect.js +1 -2
  128. package/dist/output/send-authorize-redirect.js.map +1 -1
  129. package/dist/output/send-web-page.d.ts +0 -1
  130. package/dist/output/send-web-page.d.ts.map +1 -1
  131. package/dist/output/send-web-page.js +2 -3
  132. package/dist/output/send-web-page.js.map +1 -1
  133. package/dist/replay/replay-store-redis.d.ts +1 -1
  134. package/dist/replay/replay-store-redis.d.ts.map +1 -1
  135. package/dist/replay/replay-store.js +3 -4
  136. package/dist/replay/replay-store.js.map +1 -1
  137. package/dist/request/code.d.ts +1 -1
  138. package/dist/request/code.d.ts.map +1 -1
  139. package/dist/request/request-data.d.ts.map +1 -1
  140. package/dist/request/request-id.d.ts.map +1 -1
  141. package/dist/request/request-manager.d.ts.map +1 -1
  142. package/dist/request/request-manager.js +2 -1
  143. package/dist/request/request-manager.js.map +1 -1
  144. package/dist/request/request-store-redis.d.ts +1 -1
  145. package/dist/request/request-store-redis.d.ts.map +1 -1
  146. package/dist/request/request-store-redis.js.map +1 -1
  147. package/dist/request/request-store.js +2 -3
  148. package/dist/request/request-store.js.map +1 -1
  149. package/dist/request/request-uri.js +3 -3
  150. package/dist/request/request-uri.js.map +1 -1
  151. package/dist/signer/signed-token-payload.d.ts +90 -90
  152. package/dist/signer/signed-token-payload.d.ts.map +1 -1
  153. package/dist/signer/signer.d.ts +6 -6
  154. package/dist/signer/signer.d.ts.map +1 -1
  155. package/dist/token/refresh-token.d.ts +1 -1
  156. package/dist/token/refresh-token.d.ts.map +1 -1
  157. package/dist/token/token-claims.d.ts +90 -90
  158. package/dist/token/token-claims.d.ts.map +1 -1
  159. package/dist/token/token-id.d.ts +1 -1
  160. package/dist/token/token-id.d.ts.map +1 -1
  161. package/dist/token/token-store.js +2 -3
  162. package/dist/token/token-store.js.map +1 -1
  163. package/dist/token/verify-token-claims.js +1 -2
  164. package/dist/token/verify-token-claims.js.map +1 -1
  165. package/package.json +3 -7
  166. package/src/client/client-manager.ts +3 -3
  167. package/src/lib/http/stream.ts +4 -2
  168. package/src/lib/redis.ts +5 -3
  169. package/src/metadata/build-metadata.ts +6 -3
  170. package/src/oauth-provider.ts +1 -1
  171. package/src/oauth-verifier.ts +1 -1
  172. package/src/replay/replay-store-redis.ts +1 -1
  173. package/src/request/request-manager.ts +4 -1
  174. package/src/request/request-store-redis.ts +2 -1
  175. package/tsconfig.backend.tsbuildinfo +1 -0
  176. package/tsconfig.frontend.tsbuildinfo +1 -0
  177. package/tsconfig.tools.tsbuildinfo +1 -0
@@ -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,WAAW,CAAA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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')) {
@@ -67,7 +68,6 @@ function createFinalHandler(req, res, options) {
67
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,IAAI,IAAI,CAC7C,CAAA;IAED,uEAAuE;IACvE,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,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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,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,CAAC,CAAA;CACzD,CAAA;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IA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AW,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,OAAO,IAAA,cAAe,EAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,uBAAuB;QACvB,MAAM,IAAA,qBAAe,EACnB,GAAG,EACH,GAAG,YAAY,KAAK,CAA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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,MAAM,QAAQ,GAAG,OAAO;iBACrB,KAAK,CAAC,CAAC,CAAC;iBACR,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAA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B;gBAC/B,MAAM,MAAM,GAA2B,EAAE,CAAA;gBACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAA;oBAC9B,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAA;oBAE7B,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;oBAE3B,0CAA0C;oBAC1C,IAAI,CAAC,KAAK;wBAAE,OAAO,SAAS,CAAA;oBAE5B,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;gBACtB,CAAC;gBAED,OAAO,MAAW,CAAA;YACpB,CAAC,CAAA;QACH,CAAC;QAED,OAAO,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAE,EAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC3E,CAAC;IAED,IAAI,OAAO,YAAY,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,OAAe,EAAE,EAAE;YACzB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACpC,OAAO,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAO,CAAC,CAAC,CAAC,SAAS,CAAA;QACxD,CAAC,CAAA;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { IncomingMessage, ServerResponse } from './types.js';
3
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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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,IAAI,SAAS,CAC7B,CAAA;IACH,CAAC;AACH,CAAC;AAnBD,kDAmBC;AAED,SAAgB,iBAAiB,CAC/B,GAAoB,EACpB,GAAmB,EACnB,YAMG;IAEH,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,E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Q,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC,IAAI,CAAA;AACZ,CAAC"}
@@ -1,6 +1,3 @@
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;
@@ -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,C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M,SAAM,EACZ,WAAW,SAAc,GACxB,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -1,6 +1,12 @@
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.staticJsonHandler = staticJsonHandler;
9
+ exports.writeHtml = writeHtml;
4
10
  const node_stream_1 = require("node:stream");
5
11
  const promises_1 = require("node:stream/promises");
6
12
  const node_zlib_1 = require("node:zlib");
@@ -14,11 +20,9 @@ function appendHeader(res, header, value) {
14
20
  res.setHeader(header, arr.concat(value));
15
21
  }
16
22
  }
17
- exports.appendHeader = appendHeader;
18
23
  function writeRedirect(res, url, status = 302) {
19
24
  res.writeHead(status, { Location: url }).end();
20
25
  }
21
- exports.writeRedirect = writeRedirect;
22
26
  function negotiateEncoding(accept) {
23
27
  if (accept?.includes('br'))
24
28
  return 'br';
@@ -72,27 +76,22 @@ async function writeStream(res, stream, contentType = ifString(stream.headers?.[
72
76
  throw err;
73
77
  }
74
78
  }
75
- exports.writeStream = writeStream;
76
79
  async function writeBuffer(res, buffer, contentType, status = 200) {
77
80
  const stream = node_stream_1.Readable.from([buffer]);
78
81
  return writeStream(res, stream, contentType, status);
79
82
  }
80
- exports.writeBuffer = writeBuffer;
81
83
  async function writeJson(res, payload, status = 200, contentType = 'application/json') {
82
84
  const buffer = Buffer.from(JSON.stringify(payload));
83
85
  return writeBuffer(res, buffer, contentType, status);
84
86
  }
85
- exports.writeJson = writeJson;
86
87
  function staticJsonHandler(value, contentType = 'application/json', status = 200) {
87
88
  const buffer = Buffer.from(JSON.stringify(value));
88
89
  return function (req, res, next) {
89
90
  void writeBuffer(res, buffer, contentType, status).catch(next);
90
91
  };
91
92
  }
92
- exports.staticJsonHandler = staticJsonHandler;
93
93
  async function writeHtml(res, html, status = 200, contentType = 'text/html') {
94
94
  const buffer = Buffer.isBuffer(html) ? html : Buffer.from(html);
95
95
  return writeBuffer(res, buffer, contentType, status);
96
96
  }
97
- exports.writeHtml = writeHtml;
98
97
  //# 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,QAAQ,CAAC,MAA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AC,CAAA;AACtD,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,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAExE,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,MAAM,CAAC,CAAC,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
+ {"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,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAExE,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,MAAM,CAAC,CAAC,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,IAAA,2BAAiB,EAAI,IAAI,CAAC,CAAA;IAChD,MAAM,aAAa,GAAG,IAAA,+BAAmB,EAAC,MAAM,CAAC,CAAA;IAEjD,MAAM,UAAU,GAAG,IAAA,kCAAkB,EAAC,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAA;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;AA3BD,kCA2BC"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/lib/http/route.ts"],"names":[],"mappings":";;AA4BA,kCA2BC;AAvDD,6CAA6C;AAC7C,2CAAqE;AACrE,mDAAoD;AACpD,uCAA2D;AAW3D;;;;;;;;;;;;;GAaG;AACH,SAAgB,WAAW,CAMzB,MAA0B,EAC1B,IAAa,EACb,GAAG,EAAqC;IAExC,MAAM,aAAa,GAAG,IAAA,2BAAiB,EAAI,IAAI,CAAC,CAAA;IAChD,MAAM,aAAa,GAAG,IAAA,+BAAmB,EAAC,MAAM,CAAC,CAAA;IAEjD,MAAM,UAAU,GAAG,IAAA,kCAAkB,EAAC,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAA;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,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,eAAe,EAAe,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAExE,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE;IAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CAAA;AAC5D,MAAM,MAAM,gBAAgB,CAC1B,CAAC,GAAG,IAAI,EACR,GAAG,GAAG,eAAe,EACrB,GAAG,GAAG,cAAc,IAClB,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAEtC,qBAAa,MAAM,CACjB,CAAC,GAAG,IAAI,EACR,GAAG,SAAS,eAAe,GAAG,eAAe,EAC7C,GAAG,SAAS,cAAc,GAAG,cAAc;IAKzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;IAHvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsC;gBAG/C,GAAG,CAAC;QACnB,gFAAgF;;QAEhF,gFAAgF;;iBAEjF;IAGH,GAAG,CAAC,GAAG,WAAW,EAAE,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IA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AAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IAKrD,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAC5B,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,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAC/B,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,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"}
@@ -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.parseHttpRequest = exports.decodeHttpRequest = void 0;
6
+ exports.decodeHttpRequest = decodeHttpRequest;
7
+ exports.parseHttpRequest = parseHttpRequest;
7
8
  const common_1 = require("@atproto/common");
8
9
  const http_errors_1 = __importDefault(require("http-errors"));
9
10
  const parser_js_1 = require("./parser.js");
@@ -11,11 +12,11 @@ function decodeHttpRequest(req) {
11
12
  try {
12
13
  return (0, common_1.decodeStream)(req, req.headers['content-encoding']);
13
14
  }
14
- catch (err) {
15
- throw (0, http_errors_1.default)(415, err, { expose: err instanceof TypeError });
15
+ catch (cause) {
16
+ const message = cause instanceof TypeError ? cause.message : `Invalid content-encoding`;
17
+ throw (0, http_errors_1.default)(415, message, { cause });
16
18
  }
17
19
  }
18
- exports.decodeHttpRequest = decodeHttpRequest;
19
20
  /**
20
21
  * Generic method that parses a stream of unknown nature (HTTP request/response,
21
22
  * socket, file, etc.), but of known mime type, into a parsed object.
@@ -32,5 +33,4 @@ async function parseHttpRequest(req, allow) {
32
33
  const buffer = await (0, common_1.streamToNodeBuffer)(stream);
33
34
  return parser.parse(buffer, type);
34
35
  }
35
- exports.parseHttpRequest = parseHttpRequest;
36
36
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../src/lib/http/stream.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAkE;AAClE,8DAAyC;AAIzC,2CAMoB;AAEpB,SAAgB,iBAAiB,CAAC,GAAoB;IACpD,IAAI,CAAC;QACH,OAAO,IAAA,qBAAY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,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAA;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GACX,KAAK,YAAY,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAA;QACzE,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAChD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AAEI,KAAK,UAAU,gBAAgB,CACpC,GAAoB,EACpB,KAAQ;IAER,MAAM,IAAI,GAAG,IAAA,4BAAgB,EAC3B,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,0BAA0B,CAC1D,CAAA;IAED,MAAM,MAAM,GAAG,mBAAO,CAAC,IAAI,CACzB,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAClE,CAAA;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,6BAA6B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;IACtE,CAAC;IAED,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;IACrC,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAA;IAC/C,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAE/B,CAAA;AACH,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
2
  export { IncomingMessage, ServerResponse };
4
3
  export type NextFunction = (err?: unknown) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/http/types.ts"],"names":[],"mappings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,eAAe,EAAE,GAAG,GAAG,cAAc,IAAI,CAC3E,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,CAAC,EAAE,YAAY,KAChB,IAAI,CAAA"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export type UrlReference = {
3
2
  origin?: string;
4
3
  pathname?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACnD,CAAA;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,WAgBzD"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACnD,CAAA;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,WAgBzD"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.urlMatch = void 0;
3
+ exports.urlMatch = urlMatch;
4
4
  function urlMatch(url, reference) {
5
5
  if (reference.origin !== undefined) {
6
6
  if (url.origin !== reference.origin)
@@ -18,5 +18,4 @@ function urlMatch(url, reference) {
18
18
  }
19
19
  return true;
20
20
  }
21
- exports.urlMatch = urlMatch;
22
21
  //# sourceMappingURL=url.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":";;;AAMA,SAAgB,QAAQ,CAAC,GAAQ,EAAE,SAAuB;IACxD,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACnC,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;YAAE,OAAO,KAAK,CAAA;IACnD,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAA;IACvD,CAAC;IAED,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;YAClD,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK;gBAAE,OAAO,KAAK,CAAA;QACvD,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAhBD,4BAgBC"}
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":";;AAMA,4BAgBC;AAhBD,SAAgB,QAAQ,CAAC,GAAQ,EAAE,SAAuB;IACxD,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACnC,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;YAAE,OAAO,KAAK,CAAA;IACnD,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAA;IACvD,CAAC;IAED,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;YAClD,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK;gBAAE,OAAO,KAAK,CAAA;QACvD,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,CAAA;AAEnC,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,YAAY,GAAG,MAAM,CAAA;AAE9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,KAAK,CAgB9D"}
1
+ {"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,CAAA;AAEnC,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,YAAY,GAAG,MAAM,CAAA;AAE9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,KAAK,CAkB9D"}
package/dist/lib/redis.js CHANGED
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRedis = void 0;
3
+ exports.createRedis = createRedis;
4
4
  const ioredis_1 = require("ioredis");
5
5
  function createRedis(options) {
6
- if (options instanceof ioredis_1.Redis) {
7
- return options;
8
- }
9
- else if (typeof options === 'string') {
6
+ if (typeof options === 'string') {
10
7
  const url = new URL(options.startsWith('redis://') ? options : `redis://${options}`);
11
8
  return new ioredis_1.Redis({
12
9
  host: url.hostname,
@@ -14,9 +11,13 @@ function createRedis(options) {
14
11
  password: url.password,
15
12
  });
16
13
  }
14
+ else if ('on' in options && 'call' in options && 'acl' in options) {
15
+ // Not using "instanceof" here in case the options is an instance of another
16
+ // version of ioredis (Redis is both a class and an interface).
17
+ return options;
18
+ }
17
19
  else {
18
20
  return new ioredis_1.Redis(options);
19
21
  }
20
22
  }
21
- exports.createRedis = createRedis;
22
23
  //# sourceMappingURL=redis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redis.js","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":";;;AAAA,qCAAkD;AAMlD,SAAgB,WAAW,CAAC,OAA2B;IACrD,IAAI,OAAO,YAAY,eAAK,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAA;IAChB,CAAC;SAAM,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE,CAChE,CAAA;QAED,OAAO,IAAI,eAAK,CAAC;YACf,IAAI,EAAE,GAAG,CAAC,QAAQ;YAClB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YAC5B,QAAQ,EAAE,GAAG,CAAC,QAAQ;SACvB,CAAC,CAAA;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,eAAK,CAAC,OAAO,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC;AAhBD,kCAgBC"}
1
+ {"version":3,"file":"redis.js","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":";;AAMA,kCAkBC;AAxBD,qCAAkD;AAMlD,SAAgB,WAAW,CAAC,OAA2B;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,IAAI,GAAG,C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