@inversifyjs/http-better-auth 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +21 -0
  3. package/README.md +6 -0
  4. package/lib/cjs/auth/calculations/buildBetterAuthExpress4Controller.d.ts +3 -0
  5. package/lib/cjs/auth/calculations/buildBetterAuthExpress4Controller.d.ts.map +1 -0
  6. package/lib/cjs/auth/calculations/buildBetterAuthExpress4Controller.js +34 -0
  7. package/lib/cjs/auth/calculations/buildBetterAuthExpress4Controller.js.map +1 -0
  8. package/lib/cjs/auth/calculations/buildBetterAuthExpressController.d.ts +3 -0
  9. package/lib/cjs/auth/calculations/buildBetterAuthExpressController.d.ts.map +1 -0
  10. package/lib/cjs/auth/calculations/buildBetterAuthExpressController.js +34 -0
  11. package/lib/cjs/auth/calculations/buildBetterAuthExpressController.js.map +1 -0
  12. package/lib/cjs/auth/calculations/buildBetterAuthFastifyController.d.ts +3 -0
  13. package/lib/cjs/auth/calculations/buildBetterAuthFastifyController.d.ts.map +1 -0
  14. package/lib/cjs/auth/calculations/buildBetterAuthFastifyController.js +86 -0
  15. package/lib/cjs/auth/calculations/buildBetterAuthFastifyController.js.map +1 -0
  16. package/lib/cjs/auth/calculations/buildBetterAuthHonoController.d.ts +3 -0
  17. package/lib/cjs/auth/calculations/buildBetterAuthHonoController.d.ts.map +1 -0
  18. package/lib/cjs/auth/calculations/buildBetterAuthHonoController.js +32 -0
  19. package/lib/cjs/auth/calculations/buildBetterAuthHonoController.js.map +1 -0
  20. package/lib/cjs/auth/calculations/buildBetterAuthMiddleware.d.ts +6 -0
  21. package/lib/cjs/auth/calculations/buildBetterAuthMiddleware.d.ts.map +1 -0
  22. package/lib/cjs/auth/calculations/buildBetterAuthMiddleware.js +13 -0
  23. package/lib/cjs/auth/calculations/buildBetterAuthMiddleware.js.map +1 -0
  24. package/lib/cjs/auth/calculations/buildUserSessionFromExpressRequest.d.ts +5 -0
  25. package/lib/cjs/auth/calculations/buildUserSessionFromExpressRequest.d.ts.map +1 -0
  26. package/lib/cjs/auth/calculations/buildUserSessionFromExpressRequest.js +13 -0
  27. package/lib/cjs/auth/calculations/buildUserSessionFromExpressRequest.js.map +1 -0
  28. package/lib/cjs/auth/calculations/buildUserSessionFromExpressRequest.spec.d.ts +2 -0
  29. package/lib/cjs/auth/calculations/buildUserSessionFromExpressRequest.spec.d.ts.map +1 -0
  30. package/lib/cjs/auth/calculations/buildUserSessionFromFastifyRequest.d.ts +5 -0
  31. package/lib/cjs/auth/calculations/buildUserSessionFromFastifyRequest.d.ts.map +1 -0
  32. package/lib/cjs/auth/calculations/buildUserSessionFromFastifyRequest.js +13 -0
  33. package/lib/cjs/auth/calculations/buildUserSessionFromFastifyRequest.js.map +1 -0
  34. package/lib/cjs/auth/calculations/buildUserSessionFromFastifyRequest.spec.d.ts +2 -0
  35. package/lib/cjs/auth/calculations/buildUserSessionFromFastifyRequest.spec.d.ts.map +1 -0
  36. package/lib/cjs/auth/calculations/buildUserSessionFromHonoRequest.d.ts +5 -0
  37. package/lib/cjs/auth/calculations/buildUserSessionFromHonoRequest.d.ts.map +1 -0
  38. package/lib/cjs/auth/calculations/buildUserSessionFromHonoRequest.js +14 -0
  39. package/lib/cjs/auth/calculations/buildUserSessionFromHonoRequest.js.map +1 -0
  40. package/lib/cjs/auth/calculations/buildUserSessionFromHonoRequest.spec.d.ts +2 -0
  41. package/lib/cjs/auth/calculations/buildUserSessionFromHonoRequest.spec.d.ts.map +1 -0
  42. package/lib/cjs/auth/calculations/getBetterAuthFromRequest.d.ts +4 -0
  43. package/lib/cjs/auth/calculations/getBetterAuthFromRequest.d.ts.map +1 -0
  44. package/lib/cjs/auth/calculations/getBetterAuthFromRequest.js +13 -0
  45. package/lib/cjs/auth/calculations/getBetterAuthFromRequest.js.map +1 -0
  46. package/lib/cjs/auth/calculations/getBetterAuthFromRequest.spec.d.ts +2 -0
  47. package/lib/cjs/auth/calculations/getBetterAuthFromRequest.spec.d.ts.map +1 -0
  48. package/lib/cjs/auth/decorators/ExpressUserSession.d.ts +2 -0
  49. package/lib/cjs/auth/decorators/ExpressUserSession.d.ts.map +1 -0
  50. package/lib/cjs/auth/decorators/ExpressUserSession.int.spec.d.ts +2 -0
  51. package/lib/cjs/auth/decorators/ExpressUserSession.int.spec.d.ts.map +1 -0
  52. package/lib/cjs/auth/decorators/ExpressUserSession.js +10 -0
  53. package/lib/cjs/auth/decorators/ExpressUserSession.js.map +1 -0
  54. package/lib/cjs/auth/decorators/ExpressUserSession.spec.d.ts +2 -0
  55. package/lib/cjs/auth/decorators/ExpressUserSession.spec.d.ts.map +1 -0
  56. package/lib/cjs/auth/decorators/FastifyUserSession.d.ts +2 -0
  57. package/lib/cjs/auth/decorators/FastifyUserSession.d.ts.map +1 -0
  58. package/lib/cjs/auth/decorators/FastifyUserSession.int.spec.d.ts +2 -0
  59. package/lib/cjs/auth/decorators/FastifyUserSession.int.spec.d.ts.map +1 -0
  60. package/lib/cjs/auth/decorators/FastifyUserSession.js +10 -0
  61. package/lib/cjs/auth/decorators/FastifyUserSession.js.map +1 -0
  62. package/lib/cjs/auth/decorators/FastifyUserSession.spec.d.ts +2 -0
  63. package/lib/cjs/auth/decorators/FastifyUserSession.spec.d.ts.map +1 -0
  64. package/lib/cjs/auth/decorators/HonoUserSession.d.ts +2 -0
  65. package/lib/cjs/auth/decorators/HonoUserSession.d.ts.map +1 -0
  66. package/lib/cjs/auth/decorators/HonoUserSession.int.spec.d.ts +2 -0
  67. package/lib/cjs/auth/decorators/HonoUserSession.int.spec.d.ts.map +1 -0
  68. package/lib/cjs/auth/decorators/HonoUserSession.js +10 -0
  69. package/lib/cjs/auth/decorators/HonoUserSession.js.map +1 -0
  70. package/lib/cjs/auth/decorators/HonoUserSession.spec.d.ts +2 -0
  71. package/lib/cjs/auth/decorators/HonoUserSession.spec.d.ts.map +1 -0
  72. package/lib/cjs/auth/models/BetterAuth.d.ts +3 -0
  73. package/lib/cjs/auth/models/BetterAuth.d.ts.map +1 -0
  74. package/lib/cjs/auth/models/BetterAuth.js +3 -0
  75. package/lib/cjs/auth/models/BetterAuth.js.map +1 -0
  76. package/lib/cjs/auth/models/UserSession.d.ts +6 -0
  77. package/lib/cjs/auth/models/UserSession.d.ts.map +1 -0
  78. package/lib/cjs/auth/models/UserSession.js +3 -0
  79. package/lib/cjs/auth/models/UserSession.js.map +1 -0
  80. package/lib/cjs/auth/models/betterAuthControllerServiceIdentifier.d.ts +2 -0
  81. package/lib/cjs/auth/models/betterAuthControllerServiceIdentifier.d.ts.map +1 -0
  82. package/lib/cjs/auth/models/betterAuthControllerServiceIdentifier.js +5 -0
  83. package/lib/cjs/auth/models/betterAuthControllerServiceIdentifier.js.map +1 -0
  84. package/lib/cjs/auth/models/betterAuthMiddlewareServiceIdentifier.d.ts +2 -0
  85. package/lib/cjs/auth/models/betterAuthMiddlewareServiceIdentifier.d.ts.map +1 -0
  86. package/lib/cjs/auth/models/betterAuthMiddlewareServiceIdentifier.js +5 -0
  87. package/lib/cjs/auth/models/betterAuthMiddlewareServiceIdentifier.js.map +1 -0
  88. package/lib/cjs/auth/models/betterAuthProperty.d.ts +2 -0
  89. package/lib/cjs/auth/models/betterAuthProperty.d.ts.map +1 -0
  90. package/lib/cjs/auth/models/betterAuthProperty.js +5 -0
  91. package/lib/cjs/auth/models/betterAuthProperty.js.map +1 -0
  92. package/lib/cjs/auth/models/betterAuthServiceIdentifier.d.ts +2 -0
  93. package/lib/cjs/auth/models/betterAuthServiceIdentifier.d.ts.map +1 -0
  94. package/lib/cjs/auth/models/betterAuthServiceIdentifier.js +5 -0
  95. package/lib/cjs/auth/models/betterAuthServiceIdentifier.js.map +1 -0
  96. package/lib/cjs/auth/services/BaseBetterAuthContainerModule.d.ts +13 -0
  97. package/lib/cjs/auth/services/BaseBetterAuthContainerModule.d.ts.map +1 -0
  98. package/lib/cjs/auth/services/BaseBetterAuthContainerModule.js +31 -0
  99. package/lib/cjs/auth/services/BaseBetterAuthContainerModule.js.map +1 -0
  100. package/lib/cjs/auth/services/BetterAuthExpress4ContainerModule.d.ts +9 -0
  101. package/lib/cjs/auth/services/BetterAuthExpress4ContainerModule.d.ts.map +1 -0
  102. package/lib/cjs/auth/services/BetterAuthExpress4ContainerModule.int.spec.d.ts +2 -0
  103. package/lib/cjs/auth/services/BetterAuthExpress4ContainerModule.int.spec.d.ts.map +1 -0
  104. package/lib/cjs/auth/services/BetterAuthExpress4ContainerModule.js +15 -0
  105. package/lib/cjs/auth/services/BetterAuthExpress4ContainerModule.js.map +1 -0
  106. package/lib/cjs/auth/services/BetterAuthExpressContainerModule.d.ts +9 -0
  107. package/lib/cjs/auth/services/BetterAuthExpressContainerModule.d.ts.map +1 -0
  108. package/lib/cjs/auth/services/BetterAuthExpressContainerModule.int.spec.d.ts +2 -0
  109. package/lib/cjs/auth/services/BetterAuthExpressContainerModule.int.spec.d.ts.map +1 -0
  110. package/lib/cjs/auth/services/BetterAuthExpressContainerModule.js +15 -0
  111. package/lib/cjs/auth/services/BetterAuthExpressContainerModule.js.map +1 -0
  112. package/lib/cjs/auth/services/BetterAuthFastifyContainerModule.d.ts +9 -0
  113. package/lib/cjs/auth/services/BetterAuthFastifyContainerModule.d.ts.map +1 -0
  114. package/lib/cjs/auth/services/BetterAuthFastifyContainerModule.int.spec.d.ts +2 -0
  115. package/lib/cjs/auth/services/BetterAuthFastifyContainerModule.int.spec.d.ts.map +1 -0
  116. package/lib/cjs/auth/services/BetterAuthFastifyContainerModule.js +15 -0
  117. package/lib/cjs/auth/services/BetterAuthFastifyContainerModule.js.map +1 -0
  118. package/lib/cjs/auth/services/BetterAuthHonoContainerModule.d.ts +9 -0
  119. package/lib/cjs/auth/services/BetterAuthHonoContainerModule.d.ts.map +1 -0
  120. package/lib/cjs/auth/services/BetterAuthHonoContainerModule.int.spec.d.ts +2 -0
  121. package/lib/cjs/auth/services/BetterAuthHonoContainerModule.int.spec.d.ts.map +1 -0
  122. package/lib/cjs/auth/services/BetterAuthHonoContainerModule.js +15 -0
  123. package/lib/cjs/auth/services/BetterAuthHonoContainerModule.js.map +1 -0
  124. package/lib/cjs/index.d.ts +11 -0
  125. package/lib/cjs/index.d.ts.map +1 -0
  126. package/lib/cjs/index.js +20 -0
  127. package/lib/cjs/index.js.map +1 -0
  128. package/lib/cjs/package.json +3 -0
  129. package/lib/esm/index.d.ts +49 -0
  130. package/lib/esm/index.d.ts.map +1 -0
  131. package/lib/esm/index.js +2 -0
  132. package/lib/esm/index.js.map +1 -0
  133. package/lib/esm/package.json +3 -0
  134. package/package.json +88 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # @inversifyjs/http-better-auth
2
+
3
+ ## 2.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `BetterAuth` type
8
+ - Added `UserSession` type
9
+ - Added `BetterAuthExpress4ContainerModule`
10
+ - Added `HonoUserSession`
11
+ - Added `BetterAuthFastifyContainerModule`
12
+ - Added `BetterAuthHonoContainerModule`
13
+ - Added `FastifyUserSession`
14
+ - Added `BetterAuthExpressContainerModule`
15
+ - Added `ExpressUserSession`
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+ - @inversifyjs/http-core@2.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 inversify
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ [![Test coverage](https://codecov.io/gh/inversify/monorepo/branch/main/graph/badge.svg?flag=%40inversifyjs%2Fhttp-core)](https://codecov.io/gh/inversify/monorepo/branch/main/graph/badge.svg?flag=%40inversifyjs%2Fhttp-core)
2
+ [![npm version](https://img.shields.io/github/package-json/v/inversify/monorepo?filename=packages%2Fframework%2Flibraries%2Fcore%2Fpackage.json&style=plastic)](https://www.npmjs.com/package/@inversifyjs/http-core)
3
+
4
+ # @inversifyjs/http-core
5
+
6
+ Inversify monorepo http core modules.
@@ -0,0 +1,3 @@
1
+ import { Newable } from 'inversify';
2
+ export declare function buildBetterAuthExpress4Controller(basePath: string): Newable<unknown>;
3
+ //# sourceMappingURL=buildBetterAuthExpress4Controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthExpress4Controller.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthExpress4Controller.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,OAAO,EAAE,MAAM,WAAW,CAAC;AAM5C,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CA4BlB"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildBetterAuthExpress4Controller = buildBetterAuthExpress4Controller;
4
+ const tslib_1 = require("tslib");
5
+ const http_core_1 = require("@inversifyjs/http-core");
6
+ const node_1 = require("better-auth/node");
7
+ const inversify_1 = require("inversify");
8
+ const betterAuthControllerServiceIdentifier_1 = require("../models/betterAuthControllerServiceIdentifier");
9
+ const betterAuthServiceIdentifier_1 = require("../models/betterAuthServiceIdentifier");
10
+ function buildBetterAuthExpress4Controller(basePath) {
11
+ let BetterAuthExpress4Controller = class BetterAuthExpress4Controller {
12
+ #handler;
13
+ constructor(auth) {
14
+ this.#handler = (0, node_1.toNodeHandler)(auth);
15
+ }
16
+ async handle(req, res) {
17
+ await this.#handler(req, res);
18
+ }
19
+ };
20
+ tslib_1.__decorate([
21
+ (0, http_core_1.All)('/*'),
22
+ tslib_1.__param(0, (0, http_core_1.Request)()),
23
+ tslib_1.__param(1, (0, http_core_1.Response)())
24
+ ], BetterAuthExpress4Controller.prototype, "handle", null);
25
+ BetterAuthExpress4Controller = tslib_1.__decorate([
26
+ (0, http_core_1.Controller)({
27
+ path: basePath,
28
+ serviceIdentifier: betterAuthControllerServiceIdentifier_1.betterAuthControllerServiceIdentifier,
29
+ }),
30
+ tslib_1.__param(0, (0, inversify_1.inject)(betterAuthServiceIdentifier_1.betterAuthServiceIdentifier))
31
+ ], BetterAuthExpress4Controller);
32
+ return BetterAuthExpress4Controller;
33
+ }
34
+ //# sourceMappingURL=buildBetterAuthExpress4Controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthExpress4Controller.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthExpress4Controller.ts"],"names":[],"mappings":";;AAYA,8EA8BC;;AAxCD,sDAA4E;AAE5E,2CAAiD;AAEjD,yCAA4C;AAG5C,2GAAwG;AACxG,uFAAoF;AAEpF,SAAgB,iCAAiC,CAC/C,QAAgB;IAMhB,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;QACvB,QAAQ,CAGE;QAEnB,YAEE,IAA0B;YAE1B,IAAI,CAAC,QAAQ,GAAG,IAAA,oBAAa,EAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QAGY,AAAN,KAAK,CAAC,MAAM,CACN,GAAoB,EACnB,GAAqB;YAEjC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;KACF,CAAA;IANc;QADZ,IAAA,eAAG,EAAC,IAAI,CAAC;QAEP,mBAAA,IAAA,mBAAO,GAAE,CAAA;QACT,mBAAA,IAAA,oBAAQ,GAAE,CAAA;8DAGZ;IAnBG,4BAA4B;QAJjC,IAAA,sBAAU,EAAC;YACV,IAAI,EAAE,QAAQ;YACd,iBAAiB,EAAE,6EAAqC;SACzD,CAAC;QAQG,mBAAA,IAAA,kBAAM,EAAC,yDAA2B,CAAC,CAAA;OAPlC,4BAA4B,CAoBjC;IAED,OAAO,4BAA4B,CAAC;AACtC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Newable } from 'inversify';
2
+ export declare function buildBetterAuthExpressController(basePath: string): Newable<unknown>;
3
+ //# sourceMappingURL=buildBetterAuthExpressController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthExpressController.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthExpressController.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,OAAO,EAAE,MAAM,WAAW,CAAC;AAM5C,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CA4BlB"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildBetterAuthExpressController = buildBetterAuthExpressController;
4
+ const tslib_1 = require("tslib");
5
+ const http_core_1 = require("@inversifyjs/http-core");
6
+ const node_1 = require("better-auth/node");
7
+ const inversify_1 = require("inversify");
8
+ const betterAuthControllerServiceIdentifier_1 = require("../models/betterAuthControllerServiceIdentifier");
9
+ const betterAuthServiceIdentifier_1 = require("../models/betterAuthServiceIdentifier");
10
+ function buildBetterAuthExpressController(basePath) {
11
+ let BetterAuthExpressController = class BetterAuthExpressController {
12
+ #handler;
13
+ constructor(auth) {
14
+ this.#handler = (0, node_1.toNodeHandler)(auth);
15
+ }
16
+ async handle(req, res) {
17
+ await this.#handler(req, res);
18
+ }
19
+ };
20
+ tslib_1.__decorate([
21
+ (0, http_core_1.All)('/{*any}'),
22
+ tslib_1.__param(0, (0, http_core_1.Request)()),
23
+ tslib_1.__param(1, (0, http_core_1.Response)())
24
+ ], BetterAuthExpressController.prototype, "handle", null);
25
+ BetterAuthExpressController = tslib_1.__decorate([
26
+ (0, http_core_1.Controller)({
27
+ path: basePath,
28
+ serviceIdentifier: betterAuthControllerServiceIdentifier_1.betterAuthControllerServiceIdentifier,
29
+ }),
30
+ tslib_1.__param(0, (0, inversify_1.inject)(betterAuthServiceIdentifier_1.betterAuthServiceIdentifier))
31
+ ], BetterAuthExpressController);
32
+ return BetterAuthExpressController;
33
+ }
34
+ //# sourceMappingURL=buildBetterAuthExpressController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthExpressController.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthExpressController.ts"],"names":[],"mappings":";;AAYA,4EA8BC;;AAxCD,sDAA4E;AAE5E,2CAAiD;AAEjD,yCAA4C;AAG5C,2GAAwG;AACxG,uFAAoF;AAEpF,SAAgB,gCAAgC,CAC9C,QAAgB;IAMhB,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;QACtB,QAAQ,CAGE;QAEnB,YAEE,IAA0B;YAE1B,IAAI,CAAC,QAAQ,GAAG,IAAA,oBAAa,EAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QAGY,AAAN,KAAK,CAAC,MAAM,CACN,GAAoB,EACnB,GAAqB;YAEjC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;KACF,CAAA;IANc;QADZ,IAAA,eAAG,EAAC,SAAS,CAAC;QAEZ,mBAAA,IAAA,mBAAO,GAAE,CAAA;QACT,mBAAA,IAAA,oBAAQ,GAAE,CAAA;6DAGZ;IAnBG,2BAA2B;QAJhC,IAAA,sBAAU,EAAC;YACV,IAAI,EAAE,QAAQ;YACd,iBAAiB,EAAE,6EAAqC;SACzD,CAAC;QAQG,mBAAA,IAAA,kBAAM,EAAC,yDAA2B,CAAC,CAAA;OAPlC,2BAA2B,CAoBhC;IAED,OAAO,2BAA2B,CAAC;AACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Newable } from 'inversify';
2
+ export declare function buildBetterAuthFastifyController(basePath: string): Newable<unknown>;
3
+ //# sourceMappingURL=buildBetterAuthFastifyController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthFastifyController.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthFastifyController.ts"],"names":[],"mappings":"AAaA,OAAO,EAAU,OAAO,EAAE,MAAM,WAAW,CAAC;AAM5C,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAkGlB"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /*
3
+ * Better Auth Fastify Controller
4
+ * https://www.better-auth.com/docs/integrations/fastify
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.buildBetterAuthFastifyController = buildBetterAuthFastifyController;
8
+ const tslib_1 = require("tslib");
9
+ const http_core_1 = require("@inversifyjs/http-core");
10
+ const inversify_1 = require("inversify");
11
+ const betterAuthControllerServiceIdentifier_1 = require("../models/betterAuthControllerServiceIdentifier");
12
+ const betterAuthServiceIdentifier_1 = require("../models/betterAuthServiceIdentifier");
13
+ function buildBetterAuthFastifyController(basePath) {
14
+ let BetterAuthFastifyController = class BetterAuthFastifyController {
15
+ #auth;
16
+ constructor(auth) {
17
+ this.#auth = auth;
18
+ }
19
+ async handle(request, reply) {
20
+ const req = this.#buildRequest(request);
21
+ const response = await this.#auth.handler(req);
22
+ await this.#sendResponse(response, reply);
23
+ }
24
+ #appendBody(headers, request, requestInit) {
25
+ if (request.body !== undefined) {
26
+ const contentType = headers.get('content-type');
27
+ if (contentType !== null &&
28
+ contentType.includes('application/x-www-form-urlencoded')) {
29
+ requestInit.body = new URLSearchParams(request.body);
30
+ }
31
+ else {
32
+ requestInit.body = JSON.stringify(request.body);
33
+ }
34
+ }
35
+ }
36
+ #buildHeaders(request) {
37
+ const headers = new Headers();
38
+ for (const [key, value] of Object.entries(request.headers)) {
39
+ if (value !== undefined) {
40
+ if (Array.isArray(value)) {
41
+ for (const valueElement of value) {
42
+ headers.append(key, valueElement);
43
+ }
44
+ }
45
+ else {
46
+ headers.append(key, value);
47
+ }
48
+ }
49
+ }
50
+ return headers;
51
+ }
52
+ #buildRequest(request) {
53
+ const headers = this.#buildHeaders(request);
54
+ const requestInit = {
55
+ headers,
56
+ method: request.method,
57
+ };
58
+ this.#appendBody(headers, request, requestInit);
59
+ return new Request(this.#buildUrl(request), requestInit);
60
+ }
61
+ #buildUrl(request) {
62
+ return new URL(request.url, `${request.protocol}://${request.host}`);
63
+ }
64
+ async #sendResponse(response, reply) {
65
+ reply.status(response.status);
66
+ for (const [key, value] of response.headers) {
67
+ reply.header(key, value);
68
+ }
69
+ reply.send(response.body === null ? null : await response.text());
70
+ }
71
+ };
72
+ tslib_1.__decorate([
73
+ (0, http_core_1.All)('/*'),
74
+ tslib_1.__param(0, (0, http_core_1.Request)()),
75
+ tslib_1.__param(1, (0, http_core_1.Response)())
76
+ ], BetterAuthFastifyController.prototype, "handle", null);
77
+ BetterAuthFastifyController = tslib_1.__decorate([
78
+ (0, http_core_1.Controller)({
79
+ path: basePath,
80
+ serviceIdentifier: betterAuthControllerServiceIdentifier_1.betterAuthControllerServiceIdentifier,
81
+ }),
82
+ tslib_1.__param(0, (0, inversify_1.inject)(betterAuthServiceIdentifier_1.betterAuthServiceIdentifier))
83
+ ], BetterAuthFastifyController);
84
+ return BetterAuthFastifyController;
85
+ }
86
+ //# sourceMappingURL=buildBetterAuthFastifyController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthFastifyController.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthFastifyController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAgBH,4EAoGC;;AAlHD,sDAKgC;AAGhC,yCAA4C;AAG5C,2GAAwG;AACxG,uFAAoF;AAEpF,SAAgB,gCAAgC,CAC9C,QAAgB;IAMhB,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;QACtB,KAAK,CAAuB;QAErC,YAEE,IAA0B;YAE1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;QAGY,AAAN,KAAK,CAAC,MAAM,CACG,OAAuB,EACtB,KAAmB;YAExC,MAAM,GAAG,GAAY,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAEjD,MAAM,QAAQ,GAAa,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAEzD,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;QAED,WAAW,CACT,OAAgB,EAChB,OAAuB,EACvB,WAAwB;YAExB,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC/B,MAAM,WAAW,GAAkB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;gBAE/D,IACE,WAAW,KAAK,IAAI;oBACpB,WAAW,CAAC,QAAQ,CAAC,mCAAmC,CAAC,EACzD,CAAC;oBACD,WAAW,CAAC,IAAI,GAAG,IAAI,eAAe,CACpC,OAAO,CAAC,IAA8B,CACvC,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;QACH,CAAC;QAED,aAAa,CAAC,OAAuB;YACnC,MAAM,OAAO,GAAY,IAAI,OAAO,EAAE,CAAC;YAEvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;wBACzB,KAAK,MAAM,YAAY,IAAI,KAAK,EAAE,CAAC;4BACjC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;wBACpC,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBAC7B,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,aAAa,CAAC,OAAuB;YACnC,MAAM,OAAO,GAAY,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAErD,MAAM,WAAW,GAAgB;gBAC/B,OAAO;gBACP,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC;YAEF,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YAEhD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;QAC3D,CAAC;QAED,SAAS,CAAC,OAAuB;YAC/B,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,QAAQ,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,KAAK,CAAC,aAAa,CACjB,QAAkB,EAClB,KAAmB;YAEnB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAE9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;gBAC5C,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC3B,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QACpE,CAAC;KACF,CAAA;IA/Ec;QADZ,IAAA,eAAG,EAAC,IAAI,CAAC;QAEP,mBAAA,IAAA,mBAAgB,GAAE,CAAA;QAClB,mBAAA,IAAA,oBAAiB,GAAE,CAAA;6DAOrB;IApBG,2BAA2B;QAJhC,IAAA,sBAAU,EAAC;YACV,IAAI,EAAE,QAAQ;YACd,iBAAiB,EAAE,6EAAqC;SACzD,CAAC;QAKG,mBAAA,IAAA,kBAAM,EAAC,yDAA2B,CAAC,CAAA;OAJlC,2BAA2B,CA0FhC;IAED,OAAO,2BAA2B,CAAC;AACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Newable } from 'inversify';
2
+ export declare function buildBetterAuthHonoController(basePath: string): Newable<unknown>;
3
+ //# sourceMappingURL=buildBetterAuthHonoController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthHonoController.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthHonoController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,OAAO,EAAE,MAAM,WAAW,CAAC;AAM5C,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAsBlB"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildBetterAuthHonoController = buildBetterAuthHonoController;
4
+ const tslib_1 = require("tslib");
5
+ const http_core_1 = require("@inversifyjs/http-core");
6
+ const inversify_1 = require("inversify");
7
+ const betterAuthControllerServiceIdentifier_1 = require("../models/betterAuthControllerServiceIdentifier");
8
+ const betterAuthServiceIdentifier_1 = require("../models/betterAuthServiceIdentifier");
9
+ function buildBetterAuthHonoController(basePath) {
10
+ let BetterAuthHonoController = class BetterAuthHonoController {
11
+ #auth;
12
+ constructor(auth) {
13
+ this.#auth = auth;
14
+ }
15
+ async handle(c) {
16
+ return this.#auth.handler(c.req.raw);
17
+ }
18
+ };
19
+ tslib_1.__decorate([
20
+ (0, http_core_1.All)('/*'),
21
+ tslib_1.__param(0, (0, http_core_1.Response)())
22
+ ], BetterAuthHonoController.prototype, "handle", null);
23
+ BetterAuthHonoController = tslib_1.__decorate([
24
+ (0, http_core_1.Controller)({
25
+ path: basePath,
26
+ serviceIdentifier: betterAuthControllerServiceIdentifier_1.betterAuthControllerServiceIdentifier,
27
+ }),
28
+ tslib_1.__param(0, (0, inversify_1.inject)(betterAuthServiceIdentifier_1.betterAuthServiceIdentifier))
29
+ ], BetterAuthHonoController);
30
+ return BetterAuthHonoController;
31
+ }
32
+ //# sourceMappingURL=buildBetterAuthHonoController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthHonoController.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthHonoController.ts"],"names":[],"mappings":";;AASA,sEAwBC;;AAjCD,sDAAmE;AAGnE,yCAA4C;AAG5C,2GAAwG;AACxG,uFAAoF;AAEpF,SAAgB,6BAA6B,CAC3C,QAAgB;IAMhB,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;QACnB,KAAK,CAAuB;QAErC,YAEE,IAA0B;YAE1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;QAGY,AAAN,KAAK,CAAC,MAAM,CAAa,CAAU;YACxC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC;KACF,CAAA;IAHc;QADZ,IAAA,eAAG,EAAC,IAAI,CAAC;QACW,mBAAA,IAAA,oBAAQ,GAAE,CAAA;0DAE9B;IAbG,wBAAwB;QAJ7B,IAAA,sBAAU,EAAC;YACV,IAAI,EAAE,QAAQ;YACd,iBAAiB,EAAE,6EAAqC;SACzD,CAAC;QAKG,mBAAA,IAAA,kBAAM,EAAC,yDAA2B,CAAC,CAAA;OAJlC,wBAAwB,CAc7B;IAED,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Middleware } from '@inversifyjs/http-core';
2
+ import { BetterAuthOptions } from 'better-auth';
3
+ import { Newable } from 'inversify';
4
+ import { BetterAuth } from '../models/BetterAuth';
5
+ export declare function buildBetterAuthMiddleware<TOptions extends BetterAuthOptions>(auth: BetterAuth<TOptions>): Newable<Middleware>;
6
+ //# sourceMappingURL=buildBetterAuthMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,yBAAyB,CAAC,QAAQ,SAAS,iBAAiB,EAC1E,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,GACzB,OAAO,CAAC,UAAU,CAAC,CAYrB"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildBetterAuthMiddleware = buildBetterAuthMiddleware;
4
+ const betterAuthProperty_1 = require("../models/betterAuthProperty");
5
+ function buildBetterAuthMiddleware(auth) {
6
+ return class BetterAuthMiddleware {
7
+ async execute(request, _response, next) {
8
+ request[betterAuthProperty_1.betterAuthProperty] = auth;
9
+ await next();
10
+ }
11
+ };
12
+ }
13
+ //# sourceMappingURL=buildBetterAuthMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBetterAuthMiddleware.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildBetterAuthMiddleware.ts"],"names":[],"mappings":";;AAOA,8DAcC;AAhBD,qEAAkE;AAElE,SAAgB,yBAAyB,CACvC,IAA0B;IAE1B,OAAO,MAAM,oBAAoB;QACxB,KAAK,CAAC,OAAO,CAClB,OAAgC,EAChC,SAAkB,EAClB,IAAgC;YAEhC,OAAO,CAAC,uCAAkB,CAAC,GAAG,IAAI,CAAC;YAEnC,MAAM,IAAI,EAAE,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { BetterAuthOptions } from 'better-auth';
2
+ import express from 'express';
3
+ import { UserSession } from '../models/UserSession';
4
+ export declare function buildUserSessionFromExpressRequest(request: express.Request): Promise<UserSession<BetterAuthOptions> | null>;
5
+ //# sourceMappingURL=buildUserSessionFromExpressRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromExpressRequest.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromExpressRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,OAAO,CAAC,OAAO,GACvB,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAUhD"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUserSessionFromExpressRequest = buildUserSessionFromExpressRequest;
4
+ const getBetterAuthFromRequest_1 = require("./getBetterAuthFromRequest");
5
+ async function buildUserSessionFromExpressRequest(request) {
6
+ const auth = (0, getBetterAuthFromRequest_1.getBetterAuthFromRequest)(request);
7
+ const headers = new Headers();
8
+ if (request.headers.cookie !== undefined) {
9
+ headers.append('cookie', request.headers.cookie);
10
+ }
11
+ return auth.api.getSession({ asResponse: false, headers });
12
+ }
13
+ //# sourceMappingURL=buildUserSessionFromExpressRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromExpressRequest.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromExpressRequest.ts"],"names":[],"mappings":";;AAOA,gFAYC;AAdD,yEAAsE;AAE/D,KAAK,UAAU,kCAAkC,CACtD,OAAwB;IAExB,MAAM,IAAI,GAAkC,IAAA,mDAAwB,EAAC,OAAO,CAAC,CAAC;IAE9E,MAAM,OAAO,GAAY,IAAI,OAAO,EAAE,CAAC;IAEvC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=buildUserSessionFromExpressRequest.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromExpressRequest.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromExpressRequest.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { BetterAuthOptions } from 'better-auth';
2
+ import { FastifyRequest } from 'fastify';
3
+ import { UserSession } from '../models/UserSession';
4
+ export declare function buildUserSessionFromFastifyRequest(request: FastifyRequest): Promise<UserSession<BetterAuthOptions> | null>;
5
+ //# sourceMappingURL=buildUserSessionFromFastifyRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromFastifyRequest.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromFastifyRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAUhD"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUserSessionFromFastifyRequest = buildUserSessionFromFastifyRequest;
4
+ const getBetterAuthFromRequest_1 = require("./getBetterAuthFromRequest");
5
+ async function buildUserSessionFromFastifyRequest(request) {
6
+ const auth = (0, getBetterAuthFromRequest_1.getBetterAuthFromRequest)(request);
7
+ const headers = new Headers();
8
+ if (request.headers.cookie !== undefined) {
9
+ headers.append('cookie', request.headers.cookie);
10
+ }
11
+ return auth.api.getSession({ asResponse: false, headers });
12
+ }
13
+ //# sourceMappingURL=buildUserSessionFromFastifyRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromFastifyRequest.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromFastifyRequest.ts"],"names":[],"mappings":";;AAOA,gFAYC;AAdD,yEAAsE;AAE/D,KAAK,UAAU,kCAAkC,CACtD,OAAuB;IAEvB,MAAM,IAAI,GAAkC,IAAA,mDAAwB,EAAC,OAAO,CAAC,CAAC;IAE9E,MAAM,OAAO,GAAY,IAAI,OAAO,EAAE,CAAC;IAEvC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=buildUserSessionFromFastifyRequest.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromFastifyRequest.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromFastifyRequest.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { BetterAuthOptions } from 'better-auth';
2
+ import { HonoRequest } from 'hono';
3
+ import { UserSession } from '../models/UserSession';
4
+ export declare function buildUserSessionFromHonoRequest(request: HonoRequest): Promise<UserSession<BetterAuthOptions> | null>;
5
+ //# sourceMappingURL=buildUserSessionFromHonoRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromHonoRequest.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromHonoRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAYhD"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUserSessionFromHonoRequest = buildUserSessionFromHonoRequest;
4
+ const getBetterAuthFromRequest_1 = require("./getBetterAuthFromRequest");
5
+ async function buildUserSessionFromHonoRequest(request) {
6
+ const auth = (0, getBetterAuthFromRequest_1.getBetterAuthFromRequest)(request);
7
+ const headers = new Headers();
8
+ const cookieHeader = request.header('cookie');
9
+ if (cookieHeader !== undefined) {
10
+ headers.append('cookie', cookieHeader);
11
+ }
12
+ return auth.api.getSession({ asResponse: false, headers });
13
+ }
14
+ //# sourceMappingURL=buildUserSessionFromHonoRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromHonoRequest.js","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromHonoRequest.ts"],"names":[],"mappings":";;AAOA,0EAcC;AAhBD,yEAAsE;AAE/D,KAAK,UAAU,+BAA+B,CACnD,OAAoB;IAEpB,MAAM,IAAI,GAAkC,IAAA,mDAAwB,EAAC,OAAO,CAAC,CAAC;IAE9E,MAAM,OAAO,GAAY,IAAI,OAAO,EAAE,CAAC;IAEvC,MAAM,YAAY,GAAuB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAElE,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=buildUserSessionFromHonoRequest.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUserSessionFromHonoRequest.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/buildUserSessionFromHonoRequest.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { BetterAuthOptions } from 'better-auth';
2
+ import { BetterAuth } from '../models/BetterAuth';
3
+ export declare function getBetterAuthFromRequest<TOptions extends BetterAuthOptions>(request: object): BetterAuth<TOptions>;
4
+ //# sourceMappingURL=getBetterAuthFromRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBetterAuthFromRequest.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/getBetterAuthFromRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,wBAAwB,CAAC,QAAQ,SAAS,iBAAiB,EACzE,OAAO,EAAE,MAAM,GACd,UAAU,CAAC,QAAQ,CAAC,CAYtB"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBetterAuthFromRequest = getBetterAuthFromRequest;
4
+ const http_core_1 = require("@inversifyjs/http-core");
5
+ const betterAuthProperty_1 = require("../models/betterAuthProperty");
6
+ function getBetterAuthFromRequest(request) {
7
+ const auth = request[betterAuthProperty_1.betterAuthProperty];
8
+ if (auth === undefined) {
9
+ throw new http_core_1.InternalServerErrorHttpResponse('BetterAuth auth not found when accessing user session. Did you forget to apply the BetterAuth middleware?');
10
+ }
11
+ return auth;
12
+ }
13
+ //# sourceMappingURL=getBetterAuthFromRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBetterAuthFromRequest.js","sourceRoot":"","sources":["../../../../src/auth/calculations/getBetterAuthFromRequest.ts"],"names":[],"mappings":";;AAMA,4DAcC;AApBD,sDAAyE;AAIzE,qEAAkE;AAElE,SAAgB,wBAAwB,CACtC,OAAe;IAEf,MAAM,IAAI,GACR,OACD,CAAC,uCAAkB,CAAqC,CAAC;IAE1D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,2CAA+B,CACvC,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getBetterAuthFromRequest.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBetterAuthFromRequest.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/calculations/getBetterAuthFromRequest.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare function ExpressUserSession(): ParameterDecorator;
2
+ //# sourceMappingURL=ExpressUserSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressUserSession.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/ExpressUserSession.ts"],"names":[],"mappings":"AAKA,wBAAgB,kBAAkB,IAAI,kBAAkB,CAEvD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExpressUserSession.int.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressUserSession.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/ExpressUserSession.int.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExpressUserSession = ExpressUserSession;
4
+ const http_core_1 = require("@inversifyjs/http-core");
5
+ const buildUserSessionFromExpressRequest_1 = require("../calculations/buildUserSessionFromExpressRequest");
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ function ExpressUserSession() {
8
+ return (0, http_core_1.createCustomParameterDecorator)(buildUserSessionFromExpressRequest_1.buildUserSessionFromExpressRequest);
9
+ }
10
+ //# sourceMappingURL=ExpressUserSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressUserSession.js","sourceRoot":"","sources":["../../../../src/auth/decorators/ExpressUserSession.ts"],"names":[],"mappings":";;AAKA,gDAEC;AAPD,sDAAwE;AAExE,2GAAwG;AAExG,gEAAgE;AAChE,SAAgB,kBAAkB;IAChC,OAAO,IAAA,0CAA8B,EAAC,uEAAkC,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExpressUserSession.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressUserSession.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/ExpressUserSession.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare function FastifyUserSession(): ParameterDecorator;
2
+ //# sourceMappingURL=FastifyUserSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastifyUserSession.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/FastifyUserSession.ts"],"names":[],"mappings":"AAKA,wBAAgB,kBAAkB,IAAI,kBAAkB,CAEvD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FastifyUserSession.int.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastifyUserSession.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/FastifyUserSession.int.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FastifyUserSession = FastifyUserSession;
4
+ const http_core_1 = require("@inversifyjs/http-core");
5
+ const buildUserSessionFromFastifyRequest_1 = require("../calculations/buildUserSessionFromFastifyRequest");
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ function FastifyUserSession() {
8
+ return (0, http_core_1.createCustomParameterDecorator)(buildUserSessionFromFastifyRequest_1.buildUserSessionFromFastifyRequest);
9
+ }
10
+ //# sourceMappingURL=FastifyUserSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastifyUserSession.js","sourceRoot":"","sources":["../../../../src/auth/decorators/FastifyUserSession.ts"],"names":[],"mappings":";;AAKA,gDAEC;AAPD,sDAAwE;AAExE,2GAAwG;AAExG,gEAAgE;AAChE,SAAgB,kBAAkB;IAChC,OAAO,IAAA,0CAA8B,EAAC,uEAAkC,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FastifyUserSession.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastifyUserSession.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/FastifyUserSession.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare function HonoUserSession(): ParameterDecorator;
2
+ //# sourceMappingURL=HonoUserSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HonoUserSession.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/HonoUserSession.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,IAAI,kBAAkB,CAEpD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=HonoUserSession.int.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HonoUserSession.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/HonoUserSession.int.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HonoUserSession = HonoUserSession;
4
+ const http_core_1 = require("@inversifyjs/http-core");
5
+ const buildUserSessionFromHonoRequest_1 = require("../calculations/buildUserSessionFromHonoRequest");
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ function HonoUserSession() {
8
+ return (0, http_core_1.createCustomParameterDecorator)(buildUserSessionFromHonoRequest_1.buildUserSessionFromHonoRequest);
9
+ }
10
+ //# sourceMappingURL=HonoUserSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HonoUserSession.js","sourceRoot":"","sources":["../../../../src/auth/decorators/HonoUserSession.ts"],"names":[],"mappings":";;AAKA,0CAEC;AAPD,sDAAwE;AAExE,qGAAkG;AAElG,gEAAgE;AAChE,SAAgB,eAAe;IAC7B,OAAO,IAAA,0CAA8B,EAAC,iEAA+B,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=HonoUserSession.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HonoUserSession.spec.d.ts","sourceRoot":"","sources":["../../../../src/auth/decorators/HonoUserSession.spec.ts"],"names":[],"mappings":""}