@nestjs-kit/better-auth 2.0.0 → 2.1.2

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 (133) hide show
  1. package/README.md +7 -7
  2. package/dist/admin.cjs +3 -4
  3. package/dist/admin.d.cts +1 -3
  4. package/dist/admin.d.cts.map +1 -1
  5. package/dist/admin.d.mts +1 -3
  6. package/dist/admin.d.mts.map +1 -1
  7. package/dist/admin.mjs +3 -4
  8. package/dist/api-key.cjs +4 -5
  9. package/dist/api-key.d.cts +1 -3
  10. package/dist/api-key.d.cts.map +1 -1
  11. package/dist/api-key.d.mts +1 -3
  12. package/dist/api-key.d.mts.map +1 -1
  13. package/dist/api-key.mjs +4 -5
  14. package/dist/{auth-contracts-Brh_Qko9.d.cts → auth-contracts-CADGyI0O.d.mts} +3 -53
  15. package/dist/auth-contracts-CADGyI0O.d.mts.map +1 -0
  16. package/dist/{auth-contracts-Cz7C4_Ch.d.mts → auth-contracts-zvt8ysoZ.d.cts} +3 -53
  17. package/dist/auth-contracts-zvt8ysoZ.d.cts.map +1 -0
  18. package/dist/{auth-decorators-Cu_nxWnF.cjs → auth-decorators-CJKE9wlT.cjs} +8 -10
  19. package/dist/{auth-decorators-Cu_nxWnF.cjs.map → auth-decorators-CJKE9wlT.cjs.map} +1 -1
  20. package/dist/{auth-decorators-B1mFnGJ6.mjs → auth-decorators-CkNkLNpU.mjs} +8 -10
  21. package/dist/{auth-decorators-B1mFnGJ6.mjs.map → auth-decorators-CkNkLNpU.mjs.map} +1 -1
  22. package/dist/{auth-errors-C3rbTV9p.mjs → auth-errors-JjxGDVSt.mjs} +3 -5
  23. package/dist/{auth-errors-C3rbTV9p.mjs.map → auth-errors-JjxGDVSt.mjs.map} +1 -1
  24. package/dist/{auth-errors-DmiKl0L_.cjs → auth-errors-RW7hOVI-.cjs} +3 -5
  25. package/dist/{auth-errors-DmiKl0L_.cjs.map → auth-errors-RW7hOVI-.cjs.map} +1 -1
  26. package/dist/{auth-guard-h9QB_l11.mjs → auth-guard-Da92QEK5.mjs} +4 -5
  27. package/dist/{auth-guard-h9QB_l11.mjs.map → auth-guard-Da92QEK5.mjs.map} +1 -1
  28. package/dist/{auth-guard-CLyhAEEj.cjs → auth-guard-wapEh_M_.cjs} +4 -5
  29. package/dist/{auth-guard-CLyhAEEj.cjs.map → auth-guard-wapEh_M_.cjs.map} +1 -1
  30. package/dist/{auth-module-BgcY2HpA.cjs → auth-module-ab60-WJZ.cjs} +28 -47
  31. package/dist/auth-module-ab60-WJZ.cjs.map +1 -0
  32. package/dist/{auth-module-CtHx3gRU.mjs → auth-module-uy3BBWwR.mjs} +28 -47
  33. package/dist/auth-module-uy3BBWwR.mjs.map +1 -0
  34. package/dist/{auth-scope-interceptor-BjxAL1-S.cjs → auth-scope-interceptor-Bui20-Ps.cjs} +5 -7
  35. package/dist/{auth-scope-interceptor-BjxAL1-S.cjs.map → auth-scope-interceptor-Bui20-Ps.cjs.map} +1 -1
  36. package/dist/{auth-scope-interceptor-DYPn3b8M.mjs → auth-scope-interceptor-CvCQ52dV.mjs} +5 -7
  37. package/dist/{auth-scope-interceptor-DYPn3b8M.mjs.map → auth-scope-interceptor-CvCQ52dV.mjs.map} +1 -1
  38. package/dist/{bridge-protocol-c66aEkr5.mjs → bridge-protocol-CmRsff2P.mjs} +2 -3
  39. package/dist/{bridge-protocol-BDw8opAG.cjs.map → bridge-protocol-CmRsff2P.mjs.map} +1 -1
  40. package/dist/{bridge-protocol-BDw8opAG.cjs → bridge-protocol-DNFhIKdo.cjs} +2 -3
  41. package/dist/{bridge-protocol-c66aEkr5.mjs.map → bridge-protocol-DNFhIKdo.cjs.map} +1 -1
  42. package/dist/{decorate-Dt0e9K6R.mjs → decorate-bO-rBn-G.mjs} +5 -9
  43. package/dist/{decorate-Dt0e9K6R.mjs.map → decorate-bO-rBn-G.mjs.map} +1 -1
  44. package/dist/{decorate-Cr4Q7bNE.cjs → decorate-fMNf0caZ.cjs} +5 -9
  45. package/dist/{decorate-Cr4Q7bNE.cjs.map → decorate-fMNf0caZ.cjs.map} +1 -1
  46. package/dist/express.cjs +3 -4
  47. package/dist/express.d.cts +1 -3
  48. package/dist/express.d.cts.map +1 -1
  49. package/dist/express.d.mts +1 -3
  50. package/dist/express.d.mts.map +1 -1
  51. package/dist/express.mjs +3 -4
  52. package/dist/fastify.cjs +2 -3
  53. package/dist/fastify.d.cts +1 -3
  54. package/dist/fastify.d.cts.map +1 -1
  55. package/dist/fastify.d.mts +1 -3
  56. package/dist/fastify.d.mts.map +1 -1
  57. package/dist/fastify.mjs +2 -3
  58. package/dist/graphql.cjs +7 -9
  59. package/dist/graphql.cjs.map +1 -1
  60. package/dist/graphql.d.cts +1 -3
  61. package/dist/graphql.d.cts.map +1 -1
  62. package/dist/graphql.d.mts +1 -3
  63. package/dist/graphql.d.mts.map +1 -1
  64. package/dist/graphql.mjs +7 -9
  65. package/dist/graphql.mjs.map +1 -1
  66. package/dist/index.cjs +7 -7
  67. package/dist/index.d.cts +1 -1
  68. package/dist/index.d.mts +1 -1
  69. package/dist/index.mjs +7 -7
  70. package/dist/microservices.cjs +4 -6
  71. package/dist/microservices.cjs.map +1 -1
  72. package/dist/microservices.d.cts +1 -5
  73. package/dist/microservices.d.cts.map +1 -1
  74. package/dist/microservices.d.mts +1 -5
  75. package/dist/microservices.d.mts.map +1 -1
  76. package/dist/microservices.mjs +3 -5
  77. package/dist/microservices.mjs.map +1 -1
  78. package/dist/organization.cjs +3 -4
  79. package/dist/organization.d.cts +1 -3
  80. package/dist/organization.d.cts.map +1 -1
  81. package/dist/organization.d.mts +1 -3
  82. package/dist/organization.d.mts.map +1 -1
  83. package/dist/organization.mjs +3 -4
  84. package/dist/{platform-CZl7TY8j.mjs → platform-BKYVzAv1.mjs} +3 -5
  85. package/dist/{platform-CZl7TY8j.mjs.map → platform-BKYVzAv1.mjs.map} +1 -1
  86. package/dist/{platform-YICqqYv6.cjs → platform-C67dxSls.cjs} +3 -5
  87. package/dist/{platform-YICqqYv6.cjs.map → platform-C67dxSls.cjs.map} +1 -1
  88. package/dist/platform.cjs +1 -1
  89. package/dist/platform.d.cts +0 -2
  90. package/dist/platform.d.cts.map +1 -1
  91. package/dist/platform.d.mts +0 -2
  92. package/dist/platform.d.mts.map +1 -1
  93. package/dist/platform.mjs +1 -1
  94. package/dist/plugin.cjs +4 -8
  95. package/dist/plugin.cjs.map +1 -1
  96. package/dist/plugin.d.cts +0 -4
  97. package/dist/plugin.d.cts.map +1 -1
  98. package/dist/plugin.d.mts +0 -4
  99. package/dist/plugin.d.mts.map +1 -1
  100. package/dist/plugin.mjs +4 -8
  101. package/dist/plugin.mjs.map +1 -1
  102. package/dist/{principal-readings-Ied2staw.mjs → principal-readings-BuXTU0-2.mjs} +3 -4
  103. package/dist/{principal-readings-Ied2staw.mjs.map → principal-readings-BuXTU0-2.mjs.map} +1 -1
  104. package/dist/{principal-readings-Chmt6rQV.cjs → principal-readings-JLNT58k0.cjs} +3 -4
  105. package/dist/{principal-readings-Chmt6rQV.cjs.map → principal-readings-JLNT58k0.cjs.map} +1 -1
  106. package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
  107. package/dist/testing/conformance.cjs +24 -31
  108. package/dist/testing/conformance.cjs.map +1 -1
  109. package/dist/testing/conformance.d.cts +4 -14
  110. package/dist/testing/conformance.d.cts.map +1 -1
  111. package/dist/testing/conformance.d.mts +4 -14
  112. package/dist/testing/conformance.d.mts.map +1 -1
  113. package/dist/testing/conformance.mjs +23 -30
  114. package/dist/testing/conformance.mjs.map +1 -1
  115. package/dist/testing.cjs +6 -7
  116. package/dist/testing.d.cts +1 -3
  117. package/dist/testing.d.cts.map +1 -1
  118. package/dist/testing.d.mts +1 -3
  119. package/dist/testing.d.mts.map +1 -1
  120. package/dist/testing.mjs +6 -7
  121. package/dist/websockets.cjs +7 -10
  122. package/dist/websockets.cjs.map +1 -1
  123. package/dist/websockets.d.cts +1 -7
  124. package/dist/websockets.d.cts.map +1 -1
  125. package/dist/websockets.d.mts +1 -7
  126. package/dist/websockets.d.mts.map +1 -1
  127. package/dist/websockets.mjs +7 -10
  128. package/dist/websockets.mjs.map +1 -1
  129. package/package.json +25 -25
  130. package/dist/auth-contracts-Brh_Qko9.d.cts.map +0 -1
  131. package/dist/auth-contracts-Cz7C4_Ch.d.mts.map +0 -1
  132. package/dist/auth-module-BgcY2HpA.cjs.map +0 -1
  133. package/dist/auth-module-CtHx3gRU.mjs.map +0 -1
@@ -1,10 +1,9 @@
1
- import { An as BetterAuthService, C as ConformanceCase, Ct as AuthPrincipal, E as ConformanceSkip, I as ExtensionRef, T as ConformanceRunner, U as HttpPlatform, c as AuthTransport, it as PrincipalSource, st as RequirementExpr, w as ConformanceOutcome, xt as AuthLike } from "../auth-contracts-Brh_Qko9.cjs";
1
+ import { An as BetterAuthService, C as ConformanceCase, Ct as AuthPrincipal, E as ConformanceSkip, I as ExtensionRef, T as ConformanceRunner, U as HttpPlatform, c as AuthTransport, it as PrincipalSource, st as RequirementExpr, w as ConformanceOutcome, xt as AuthLike } from "../auth-contracts-zvt8ysoZ.cjs";
2
2
  import { IncomingHttpHeaders } from "node:http";
3
3
  import { INestApplication, LoggerService, Provider } from "@nestjs/common";
4
4
  import { AbstractHttpAdapter, NestFactory } from "@nestjs/core";
5
5
  import { BetterAuthOptions, BetterAuthPlugin } from "better-auth";
6
6
  import { TestingModuleBuilder } from "@nestjs/testing";
7
- //#region src/conformance-fixtures.d.ts
8
7
  /** The trusted origin the probe plugin contributes through init(), so origin cases see the post-init set. */
9
8
  export declare const PROBE_TRUSTED_ORIGIN = "https://probe-plugin.example";
10
9
  /**
@@ -43,8 +42,6 @@ export declare function createConformanceAuth(options?: Omit<BetterAuthOptions,
43
42
  * under Jest it passes.
44
43
  */
45
44
  export declare function runConformance(cases: readonly ConformanceCase[], runner: ConformanceRunner): void;
46
- //#endregion
47
- //#region src/conformance-http.d.ts
48
45
  interface HttpConformanceOptions {
49
46
  platform: ExtensionRef<HttpPlatform>;
50
47
  /** Fresh Nest HTTP adapter per app, e.g. () => new ExpressAdapter(). */
@@ -96,8 +93,6 @@ type MicroserviceOptions = NonNullable<Parameters<typeof NestFactory.createMicro
96
93
  * so run the cases sequentially.
97
94
  */
98
95
  export declare function httpPlatformConformance(options: HttpConformanceOptions): ConformanceCase[];
99
- //#endregion
100
- //#region src/conformance-transport.d.ts
101
96
  type InvocationShape = "aliases" | "batched" | "messages" | "subscriptions";
102
97
  /** One fixture handler the kit supplies; the harness exposes it as a controller route, resolver field, gateway message or message pattern. */
103
98
  interface FixtureHandler {
@@ -346,7 +341,9 @@ interface TransportConformanceOptions {
346
341
  * The GraphQL module's `context` option of a boot: 'fresh' is a function returning a new object that keeps what the driver
347
342
  * passes it (the native request, the graphql-ws context); 'plain-request' a function returning a new object whose `req` is a
348
343
  * plain object holding only the native request's cookie header; 'cached' a function returning the object it built on its
349
- * first call; 'static' an object.
344
+ * first call, which keeps that call's request at `req` (Apollo socket operations: the graphql-ws context Nest would
345
+ * assign), because @nestjs/apollo 14.0.3 and later copy a returned object without `req` for every operation; 'static' an
346
+ * object.
350
347
  */
351
348
  type GraphqlContextShape = "fresh" | "plain-request" | "cached" | "static";
352
349
  /** The outcome of connection-time authentication (authenticateConnection). */
@@ -363,8 +360,6 @@ interface ConnectionAuthenticationResult {
363
360
  * a transport object directly and boots once for a class or a definition.
364
361
  */
365
362
  export declare function transportConformance(options: TransportConformanceOptions): ConformanceCase[];
366
- //#endregion
367
- //#region src/conformance-policy-harness.d.ts
368
363
  interface PolicyConformanceOptions {
369
364
  /**
370
365
  * The requirement to judge. Its policies must be policy objects: the kit boots no application providers, so a class
@@ -443,8 +438,6 @@ interface PolicyDeliveryConnection {
443
438
  invoke(handler: string, input?: Record<string, unknown>): Promise<TransportInvocationResult>;
444
439
  close(): Promise<void>;
445
440
  }
446
- //#endregion
447
- //#region src/conformance-policy.d.ts
448
441
  /**
449
442
  * The authorization-policy kit (invariants Z1–Z6 and the unit-specific rows of design §14.1). Each principal is judged
450
443
  * through the real AuthorizationEvaluator, so the delegation gate, error normalization and the per-invocation
@@ -456,8 +449,6 @@ interface PolicyDeliveryConnection {
456
449
  * the built-in admin, organization or API-key policy and skip with the reason otherwise.
457
450
  */
458
451
  export declare function policyConformance(options: PolicyConformanceOptions): ConformanceCase[];
459
- //#endregion
460
- //#region src/conformance-principal.d.ts
461
452
  /** An API key the kit's S-apikey-* cases created, and the request headers that present it. */
462
453
  interface ConformanceApiKey {
463
454
  /** The key's record id, which the kit uses to disable or expire the key through the database adapter. */
@@ -523,6 +514,5 @@ interface PrincipalSourceConformanceOptions {
523
514
  * the source (an API-key row for a session source, say) skips with the reason.
524
515
  */
525
516
  export declare function principalSourceConformance(options: PrincipalSourceConformanceOptions): ConformanceCase[];
526
- //#endregion
527
517
  export type { ConformanceApiKey, ConformanceAuthSettings, ConformanceCase, ConformanceOutcome, ConformanceRunner, ConformanceSkip, ConnectionAuthenticationResult, FixtureContext, FixtureHandler, GraphFixtures, GraphResult, GraphSelection, GraphqlContextShape, HttpConformanceOptions, InheritedFixture, InvocationShape, PolicyConformanceOptions, PolicyDelivery, PolicyDeliveryConnection, PrincipalHttpConformanceOptions, PrincipalSourceConformanceOptions, TransportConformanceOptions, TransportFixtures, TransportInvocationResult };
528
518
  //# sourceMappingURL=conformance.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conformance.d.cts","names":[],"sources":["../../src/conformance-fixtures.ts","../../src/conformance-http.ts","../../src/conformance-transport.ts","../../src/conformance-policy-harness.ts","../../src/conformance-policy.ts","../../src/conformance-principal.ts"],"mappings":";;;;;;;;qBAwCa;;;;;;;;wBAuKG,0BAA0B;;;;;UAmQzB;;;;;WAKN;;WAEA;;;;;;;;;wBAUK,sBACd,UAAS,KAAK,gCACd,WAAU,0BACT;;;;;;;wBAuHa,eACd,gBAAgB,mBAChB,QAAQ;;;UC5gBO;EACf,UAAU,aAAa;;EAEvB,qBAAqB;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;;;;;WAKF;;;UAIM;EACf,OACE,iBACA,QAAQ,0BACP,QAAQ;EACX,SAAS;;;;;;;;;;;;;;wBClDK,kBACd,SAAS,2BACR;;;;UCrCc;;WAEN;WACA,SAAS;;;UAIH;EACf,UAAU,aAAa;;EAEvB,qBAAqB;;EAErB,QAAQ,KAAK,mBAAmB;;UAGjB;;;;;;EAMf,QAAQ,aAAa;;;;;;EAMrB,MAAM;EACN;;;;;;IAME,MAAM,MAAM,WAAW,QAAQ;IAC/B,WAAW;IACX,aAAa,MAAM,WAAW,QAAQ;;;;;IAKtC,QACE,MAAM,UACN,QAAQ,SAAS,2BAChB,QAAQ;;IAEX,iBAAiB,MAAM,WAAW,QAAQ;;;;;;;EAO5C,SAAS,WAAW,KAAK,iCAAiC;;;;;EAK1D,OAAO;;;;;;;;;;wBA2pBO,2BACd,SAAS,oCACR"}
1
+ {"version":3,"file":"conformance.d.cts","names":[],"sources":["../../src/conformance-fixtures.ts","../../src/conformance-http.ts","../../src/conformance-transport.ts","../../src/conformance-policy-harness.ts","../../src/conformance-policy.ts","../../src/conformance-principal.ts"],"mappings":";;;;;;;qBAwCa;;;;;;;;wBAuKG,0BAA0B;;;;;UAmQzB;;;;;WAKN;;WAEA;;;;;;;;;wBAUK,sBACd,UAAS,KAAK,gCACd,WAAU,0BACT;;;;;;;wBAuHa,eACd,gBAAgB,mBAChB,QAAQ;UC5gBO;EACf,UAAU,aAAa;;EAEvB,qBAAqB;;EAErB;;EAEA,gBAAgB,KAAK,kBAAkB,wBAAwB;;;;;;EAM/D,eAAe,KAAK,0BAA0B;;;;;;;EAO9C,8BAA8B;;;;;EAK9B;IACE,qBAAqB;IACrB,8BAA8B;;;EAGhC,QAAQ,KAAK,mBAAmB;;;;;;EAMhC,iBAAiB;;;KAId,sBAAsB,YACzB,kBAAkB,YAAY;;;;;;;;;;;wBAmqBhB,wBACd,SAAS,yBACR;KCzsBS;;UAOK;;WAEN,qBAAqB;;WAErB,iBAAiB;;WAEjB;;EAET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,QAAQ;;;;;IAKtC,QACE,MAAM,UACN,QAAQ,SAAS,2BAChB,QAAQ;;IAEX,iBAAiB,MAAM,WAAW,QAAQ;;;;;;;EAO5C,SAAS,WAAW,KAAK,iCAAiC;;;;;EAK1D,OAAO;;;;;;;;;;wBA2pBO,2BACd,SAAS,oCACR"}
@@ -1,10 +1,9 @@
1
- import { An as BetterAuthService, C as ConformanceCase, Ct as AuthPrincipal, E as ConformanceSkip, I as ExtensionRef, T as ConformanceRunner, U as HttpPlatform, c as AuthTransport, it as PrincipalSource, st as RequirementExpr, w as ConformanceOutcome, xt as AuthLike } from "../auth-contracts-Cz7C4_Ch.mjs";
1
+ import { An as BetterAuthService, C as ConformanceCase, Ct as AuthPrincipal, E as ConformanceSkip, I as ExtensionRef, T as ConformanceRunner, U as HttpPlatform, c as AuthTransport, it as PrincipalSource, st as RequirementExpr, w as ConformanceOutcome, xt as AuthLike } from "../auth-contracts-CADGyI0O.mjs";
2
2
  import { INestApplication, LoggerService, Provider } from "@nestjs/common";
3
3
  import { AbstractHttpAdapter, NestFactory } from "@nestjs/core";
4
4
  import { IncomingHttpHeaders } from "node:http";
5
5
  import { BetterAuthOptions, BetterAuthPlugin } from "better-auth";
6
6
  import { TestingModuleBuilder } from "@nestjs/testing";
7
- //#region src/conformance-fixtures.d.ts
8
7
  /** The trusted origin the probe plugin contributes through init(), so origin cases see the post-init set. */
9
8
  export declare const PROBE_TRUSTED_ORIGIN = "https://probe-plugin.example";
10
9
  /**
@@ -43,8 +42,6 @@ export declare function createConformanceAuth(options?: Omit<BetterAuthOptions,
43
42
  * under Jest it passes.
44
43
  */
45
44
  export declare function runConformance(cases: readonly ConformanceCase[], runner: ConformanceRunner): void;
46
- //#endregion
47
- //#region src/conformance-http.d.ts
48
45
  interface HttpConformanceOptions {
49
46
  platform: ExtensionRef<HttpPlatform>;
50
47
  /** Fresh Nest HTTP adapter per app, e.g. () => new ExpressAdapter(). */
@@ -96,8 +93,6 @@ type MicroserviceOptions = NonNullable<Parameters<typeof NestFactory.createMicro
96
93
  * so run the cases sequentially.
97
94
  */
98
95
  export declare function httpPlatformConformance(options: HttpConformanceOptions): ConformanceCase[];
99
- //#endregion
100
- //#region src/conformance-transport.d.ts
101
96
  type InvocationShape = "aliases" | "batched" | "messages" | "subscriptions";
102
97
  /** One fixture handler the kit supplies; the harness exposes it as a controller route, resolver field, gateway message or message pattern. */
103
98
  interface FixtureHandler {
@@ -346,7 +341,9 @@ interface TransportConformanceOptions {
346
341
  * The GraphQL module's `context` option of a boot: 'fresh' is a function returning a new object that keeps what the driver
347
342
  * passes it (the native request, the graphql-ws context); 'plain-request' a function returning a new object whose `req` is a
348
343
  * plain object holding only the native request's cookie header; 'cached' a function returning the object it built on its
349
- * first call; 'static' an object.
344
+ * first call, which keeps that call's request at `req` (Apollo socket operations: the graphql-ws context Nest would
345
+ * assign), because @nestjs/apollo 14.0.3 and later copy a returned object without `req` for every operation; 'static' an
346
+ * object.
350
347
  */
351
348
  type GraphqlContextShape = "fresh" | "plain-request" | "cached" | "static";
352
349
  /** The outcome of connection-time authentication (authenticateConnection). */
@@ -363,8 +360,6 @@ interface ConnectionAuthenticationResult {
363
360
  * a transport object directly and boots once for a class or a definition.
364
361
  */
365
362
  export declare function transportConformance(options: TransportConformanceOptions): ConformanceCase[];
366
- //#endregion
367
- //#region src/conformance-policy-harness.d.ts
368
363
  interface PolicyConformanceOptions {
369
364
  /**
370
365
  * The requirement to judge. Its policies must be policy objects: the kit boots no application providers, so a class
@@ -443,8 +438,6 @@ interface PolicyDeliveryConnection {
443
438
  invoke(handler: string, input?: Record<string, unknown>): Promise<TransportInvocationResult>;
444
439
  close(): Promise<void>;
445
440
  }
446
- //#endregion
447
- //#region src/conformance-policy.d.ts
448
441
  /**
449
442
  * The authorization-policy kit (invariants Z1–Z6 and the unit-specific rows of design §14.1). Each principal is judged
450
443
  * through the real AuthorizationEvaluator, so the delegation gate, error normalization and the per-invocation
@@ -456,8 +449,6 @@ interface PolicyDeliveryConnection {
456
449
  * the built-in admin, organization or API-key policy and skip with the reason otherwise.
457
450
  */
458
451
  export declare function policyConformance(options: PolicyConformanceOptions): ConformanceCase[];
459
- //#endregion
460
- //#region src/conformance-principal.d.ts
461
452
  /** An API key the kit's S-apikey-* cases created, and the request headers that present it. */
462
453
  interface ConformanceApiKey {
463
454
  /** The key's record id, which the kit uses to disable or expire the key through the database adapter. */
@@ -523,6 +514,5 @@ interface PrincipalSourceConformanceOptions {
523
514
  * the source (an API-key row for a session source, say) skips with the reason.
524
515
  */
525
516
  export declare function principalSourceConformance(options: PrincipalSourceConformanceOptions): ConformanceCase[];
526
- //#endregion
527
517
  export type { ConformanceApiKey, ConformanceAuthSettings, ConformanceCase, ConformanceOutcome, ConformanceRunner, ConformanceSkip, ConnectionAuthenticationResult, FixtureContext, FixtureHandler, GraphFixtures, GraphResult, GraphSelection, GraphqlContextShape, HttpConformanceOptions, InheritedFixture, InvocationShape, PolicyConformanceOptions, PolicyDelivery, PolicyDeliveryConnection, PrincipalHttpConformanceOptions, PrincipalSourceConformanceOptions, TransportConformanceOptions, TransportFixtures, TransportInvocationResult };
528
518
  //# sourceMappingURL=conformance.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conformance.d.mts","names":[],"sources":["../../src/conformance-fixtures.ts","../../src/conformance-http.ts","../../src/conformance-transport.ts","../../src/conformance-policy-harness.ts","../../src/conformance-policy.ts","../../src/conformance-principal.ts"],"mappings":";;;;;;;;qBAwCa;;;;;;;;wBAuKG,0BAA0B;;;;;UAmQzB;;;;;WAKN;;WAEA;;;;;;;;;wBAUK,sBACd,UAAS,KAAK,gCACd,WAAU,0BACT;;;;;;;wBAuHa,eACd,gBAAgB,mBAChB,QAAQ;;;UC5gBO;EACf,UAAU,aAAa;;EAEvB,qBAAqB;;EAErB;;EAEA,gBAAgB,KAAK,kBAAkB,wBAAwB;;;;;;EAM/D,eAAe,KAAK,0BAA0B;;;;;;;EAO9C,8BAA8B;;;;;EAK9B;IACE,qBAAqB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;WACA,SAAS;;;UAIH;EACf,UAAU,aAAa;;EAEvB,qBAAqB;;EAErB,QAAQ,KAAK,mBAAmB;;UAGjB;;;;;;EAMf,QAAQ,aAAa;;;;;;EAMrB,MAAM;EACN;;;;;;IAME,MAAM,MAAM,WAAW,QAAQ;IAC/B,WAAW;IACX,aAAa,MAAM,WAAW,QAAQ;;;;;IAKtC,QACE,MAAM,UACN,QAAQ,SAAS,2BAChB,QAAQ;;IAEX,iBAAiB,MAAM,WAAW,QAAQ;;;;;;;EAO5C,SAAS,WAAW,KAAK,iCAAiC;;;;;EAK1D,OAAO;;;;;;;;;;wBA2pBO,2BACd,SAAS,oCACR"}
1
+ {"version":3,"file":"conformance.d.mts","names":[],"sources":["../../src/conformance-fixtures.ts","../../src/conformance-http.ts","../../src/conformance-transport.ts","../../src/conformance-policy-harness.ts","../../src/conformance-policy.ts","../../src/conformance-principal.ts"],"mappings":";;;;;;;qBAwCa;;;;;;;;wBAuKG,0BAA0B;;;;;UAmQzB;;;;;WAKN;;WAEA;;;;;;;;;wBAUK,sBACd,UAAS,KAAK,gCACd,WAAU,0BACT;;;;;;;wBAuHa,eACd,gBAAgB,mBAChB,QAAQ;UC5gBO;EACf,UAAU,aAAa;;EAEvB,qBAAqB;;EAErB;;EAEA,gBAAgB,KAAK,kBAAkB,wBAAwB;;;;;;EAM/D,eAAe,KAAK,0BAA0B;;;;;;;EAO9C,8BAA8B;;;;;EAK9B;IACE,qBAAqB;IACrB,8BAA8B;;;EAGhC,QAAQ,KAAK,mBAAmB;;;;;;EAMhC,iBAAiB;;;KAId,sBAAsB,YACzB,kBAAkB,YAAY;;;;;;;;;;;wBAmqBhB,wBACd,SAAS,yBACR;KCzsBS;;UAOK;;WAEN,qBAAqB;;WAErB,iBAAiB;;WAEjB;;EAET,OACE,4BACA,OAAO,yBACP,SAAS;;;UAKI;;WAEN,SAAS;;;;;;;UAQH,yBAAyB;WAC/B;aACE,iBAAiB;aACjB,iBAAiB;;;;;;;;UASb;WACN;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AAK,iCAAiC;;;;;EAK1D,OAAO;;;;;;;;;;wBA2pBO,2BACd,SAAS,oCACR"}
@@ -1,13 +1,13 @@
1
- import { c as isConfigurationError, l as isInfrastructureError, n as BetterAuthConfigurationError, o as getRawCause, s as isAuthFailure, t as AuthFailures } from "../auth-errors-C3rbTV9p.mjs";
2
- import { C as PRINCIPAL_RESOLVER, D as ROUTE_PLANNER, F as getBetterAuthHandleToken, M as TRANSPORT_REGISTRY, P as WS_CONNECTION_AUTH, T as REQUEST_SCOPE, _ as MOUNT_COORDINATOR, b as POLICY_RESOLVER, g as INVOCATION_VALUES, m as INSTANCE_REGISTRY, n as __decorateParam, r as __decorateMetadata, t as __decorate, y as POLICY_INVOKER, z as getExtensionToken } from "../decorate-Dt0e9K6R.mjs";
3
- import { a as absent, l as rejected, o as authenticated } from "../auth-scope-interceptor-DYPn3b8M.mjs";
4
- import { _ as deny, h as allow, m as AuthorizationEvaluator, o as BetterAuthService, s as CurrentSession, t as BetterAuthModule } from "../auth-module-CtHx3gRU.mjs";
5
- import { t as BetterAuthGuard } from "../auth-guard-h9QB_l11.mjs";
6
- import { n as EXTENSION_DEFINITION, t as BRIDGE_HANDLE } from "../bridge-protocol-c66aEkr5.mjs";
7
- import { c as OptionalAuth, d as RequireAuth, f as SkipDefaultRequirements, h as UseBetterAuth, i as BeforeAuth, l as Public, o as CurrentPrincipal, p as SkipOriginCheck, s as ForwardAuthCookies, t as AcceptPrincipals, u as Require, x as requirement } from "../auth-decorators-B1mFnGJ6.mjs";
8
- import { permission } from "../admin.mjs";
9
- import { ACTIVE_ORGANIZATION_ID, ActiveOrganizationId, activeOrganization, fromParam, orgMember, orgPermission, organizationRef } from "../organization.mjs";
1
+ import { c as isConfigurationError, l as isInfrastructureError, n as BetterAuthConfigurationError, o as getRawCause, s as isAuthFailure, t as AuthFailures } from "../auth-errors-JjxGDVSt.mjs";
2
+ import { n as EXTENSION_DEFINITION, t as BRIDGE_HANDLE } from "../bridge-protocol-CmRsff2P.mjs";
3
+ import { c as OptionalAuth, d as RequireAuth, f as SkipDefaultRequirements, h as UseBetterAuth, i as BeforeAuth, l as Public, o as CurrentPrincipal, p as SkipOriginCheck, s as ForwardAuthCookies, t as AcceptPrincipals, u as Require, x as requirement } from "../auth-decorators-CkNkLNpU.mjs";
4
+ import { _ as deny, h as allow, m as AuthorizationEvaluator, o as BetterAuthService, s as CurrentSession, t as BetterAuthModule } from "../auth-module-uy3BBWwR.mjs";
5
+ import { C as PRINCIPAL_RESOLVER, D as ROUTE_PLANNER, F as getBetterAuthHandleToken, M as TRANSPORT_REGISTRY, P as WS_CONNECTION_AUTH, T as REQUEST_SCOPE, _ as MOUNT_COORDINATOR, b as POLICY_RESOLVER, g as INVOCATION_VALUES, m as INSTANCE_REGISTRY, n as __decorateParam, r as __decorateMetadata, t as __decorate, y as POLICY_INVOKER, z as getExtensionToken } from "../decorate-bO-rBn-G.mjs";
6
+ import { t as BetterAuthGuard } from "../auth-guard-Da92QEK5.mjs";
7
+ import { a as absent, l as rejected, o as authenticated } from "../auth-scope-interceptor-CvCQ52dV.mjs";
10
8
  import { authHeadersFor, overrideAuthGuard } from "../testing.mjs";
9
+ import { ACTIVE_ORGANIZATION_ID, ActiveOrganizationId, activeOrganization, fromParam, orgMember, orgPermission, organizationRef } from "../organization.mjs";
10
+ import { permission } from "../admin.mjs";
11
11
  import { APIError, createAuthEndpoint, createAuthMiddleware, getIP, getShouldSkipSessionRefresh, isAPIError, setShouldSkipSessionRefresh } from "better-auth/api";
12
12
  import { Body, Catch, ConsoleLogger, Controller, Get, Inject, Injectable, Module, Post, Req, RequestMethod, Res, Scope, SetMetadata, UseGuards, UseInterceptors, VersioningType } from "@nestjs/common";
13
13
  import { APP_FILTER, BaseExceptionFilter, DiscoveryService, ExternalContextCreator, MetadataScanner, ModuleRef, NestFactory, Reflector } from "@nestjs/core";
@@ -22,7 +22,7 @@ import assert from "node:assert/strict";
22
22
  import { connect } from "node:http2";
23
23
  import { Socket } from "node:net";
24
24
  import { Test } from "@nestjs/testing";
25
- //#region src/database-hook-dispatcher.ts
25
+ // src/database-hook-dispatcher.ts
26
26
  /**
27
27
  * Construct all dispatchers once; bindings supply only the late-bound methods.
28
28
  *
@@ -94,8 +94,7 @@ function createDatabaseDispatchers(getBinding, countUnbound) {
94
94
  }
95
95
  };
96
96
  }
97
- //#endregion
98
- //#region src/hook-dispatcher.ts
97
+ // src/hook-dispatcher.ts
99
98
  const API_ERROR_HEADERS = Symbol.for("better-call:api-error-headers");
100
99
  const mergeContext = createDefu((object, key, value) => {
101
100
  if (Array.isArray(object[key]) && Array.isArray(value)) {
@@ -189,8 +188,7 @@ async function runAfter(binding, ctx, scope, relayMatcherError) {
189
188
  }
190
189
  return ctx.context.returned;
191
190
  }
192
- //#endregion
193
- //#region src/plugin.ts
191
+ // src/plugin.ts
194
192
  const NESTJS_PLUGIN_ID = "@nestjs-kit/better-auth";
195
193
  const isRouter = (ctx) => "_flag" in ctx && ctx._flag === "router";
196
194
  const separator = "\0";
@@ -333,8 +331,7 @@ function nestjs(options = {}) {
333
331
  }
334
332
  };
335
333
  }
336
- //#endregion
337
- //#region src/conformance-fixtures.ts
334
+ // src/conformance-fixtures.ts
338
335
  const PROBE_PLUGIN_ID = "nestjs-kit-better-auth-conformance-probe";
339
336
  /** The trusted origin the probe plugin contributes through init(), so origin cases see the post-init set. */
340
337
  const PROBE_TRUSTED_ORIGIN = "https://probe-plugin.example";
@@ -800,8 +797,7 @@ function bootIssueCodes(error) {
800
797
  visit(error);
801
798
  return codes;
802
799
  }
803
- //#endregion
804
- //#region src/conformance-http.ts
800
+ // src/conformance-http.ts
805
801
  const AUTH = "/api/auth";
806
802
  const DYNAMIC_AUTH = "/tenant/auth";
807
803
  /** The client IP of the kit's requests: baseUrl() always connects over IPv4 loopback. */
@@ -2143,8 +2139,7 @@ async function bridgeOf(auth) {
2143
2139
  const plugin = (await auth.$context).getPlugin("@nestjs-kit/better-auth");
2144
2140
  return Reflect.get(plugin, BRIDGE_HANDLE);
2145
2141
  }
2146
- //#endregion
2147
- //#region src/conformance-policy-harness.ts
2142
+ // src/conformance-policy-harness.ts
2148
2143
  /** An instance with the given overrides, built by options.variant() or createConformanceAuth(). */
2149
2144
  async function variantOf$1(options, overrides) {
2150
2145
  return options.variant ? await options.variant(overrides) : createConformanceAuth(overrides);
@@ -2543,8 +2538,7 @@ async function sessionPrincipalOf(auth, headers) {
2543
2538
  session
2544
2539
  };
2545
2540
  }
2546
- //#endregion
2547
- //#region src/conformance-policy-units.ts
2541
+ // src/conformance-policy-units.ts
2548
2542
  const ADMIN_POLICY = "better-auth:admin/permission";
2549
2543
  const ORG_POLICIES = /* @__PURE__ */ new Set(["better-auth:organization/permission", "better-auth:organization/member"]);
2550
2544
  const API_KEY_POLICY = "better-auth:api-key/permission";
@@ -3206,8 +3200,7 @@ function unitPolicyCases(options, known) {
3206
3200
  ...(options.deliveries ?? []).flatMap(deliveryCases)
3207
3201
  ];
3208
3202
  }
3209
- //#endregion
3210
- //#region src/conformance-policy.ts
3203
+ // src/conformance-policy.ts
3211
3204
  const noGrant = {
3212
3205
  description: "conformance: no grant",
3213
3206
  allows: () => false
@@ -3407,7 +3400,7 @@ function policyConformance(options) {
3407
3400
  }
3408
3401
  })));
3409
3402
  probe.storageFault = void 0;
3410
- for (const outcome of outcomes) if (customSession) assert.ok(outcome.ok && isSessionLoss(outcome.value), `with customSession a storage failure must answer the documented 401: ${outcome.ok ? JSON.stringify(outcome.value) : String(outcome.error)}`);
3403
+ for (const outcome of outcomes) if (customSession) assert.ok(outcome.ok ? isSessionLoss(outcome.value) : isInfrastructureError(outcome.error), `with customSession a storage failure must be infrastructure or the documented 401: ${outcome.ok ? JSON.stringify(outcome.value) : String(outcome.error)}`);
3411
3404
  else assert.ok(!outcome.ok && isInfrastructureError(outcome.error), `a storage failure at the policy's call must be infrastructure: ${JSON.stringify(outcome.ok && outcome.value)}`);
3412
3405
  assert.equal(sessionReads$1(probe, reads), 1, `two invocations of one request re-read the session ${sessionReads$1(probe, reads)} times during the outage`);
3413
3406
  }),
@@ -3495,8 +3488,7 @@ function policyConformance(options) {
3495
3488
  ...unitPolicyCases(options, known)
3496
3489
  ];
3497
3490
  }
3498
- //#endregion
3499
- //#region src/conformance-principal.ts
3491
+ // src/conformance-principal.ts
3500
3492
  var RecordingSink = class {
3501
3493
  values = [];
3502
3494
  append(setCookies) {
@@ -4441,8 +4433,7 @@ function jwtCases(options) {
4441
4433
  assert.ok(!isAuthFailure(!result.ok && result.error), `a key-set outage was thrown as a denial: ${String(!result.ok && result.error)}`);
4442
4434
  })];
4443
4435
  }
4444
- //#endregion
4445
- //#region src/conformance-transport.ts
4436
+ // src/conformance-transport.ts
4446
4437
  const KEY_SOURCE_ID = "@nestjs-kit/better-auth:conformance-api-key";
4447
4438
  /** An origin only a function-valued trustedOrigins returns (T-ws-origin-*). */
4448
4439
  const FUNCTION_TRUSTED_ORIGIN = "https://function-trusted.example";
@@ -5908,6 +5899,7 @@ function transportConformance(options) {
5908
5899
  ...cookie(env),
5909
5900
  cookie: later.cookie
5910
5901
  };
5902
+ const rebuilt = [];
5911
5903
  await withApp(options, env, async ({ app, logger }) => {
5912
5904
  const first = await invokeAlone(app, "required", cookie(env));
5913
5905
  succeeded(first, "the first caller of a cached context");
@@ -5920,6 +5912,7 @@ function transportConformance(options) {
5920
5912
  if (result.ok) {
5921
5913
  const principal = principalOf(result);
5922
5914
  assert.ok(principal === null || principal?.userId === later.userId, `${label} read neither its own principal nor none: ${JSON.stringify(result.body)}`);
5915
+ if (principal !== null) rebuilt.push(handler);
5923
5916
  } else denied(result, 401, void 0, label);
5924
5917
  continue;
5925
5918
  }
@@ -5938,6 +5931,7 @@ function transportConformance(options) {
5938
5931
  assert.doesNotMatch(logger.text(), /AUTH_MISCONFIGURED|GRAPHQL_CONTEXT_STALE_REQUEST/);
5939
5932
  }
5940
5933
  }, { graphqlContext: "cached" });
5934
+ if (rebuilt.length > 0) return conformanceSkip(`the later caller of ${rebuilt.join(" and ")} read its own principal, so the driver built a new context for its connection instead of serving the cached one, and no closed connection's context reached the transport`);
5941
5935
  });
5942
5936
  /** The claimed site of each graph fixture handler of a booted app, by fixture name. */
5943
5937
  const graphSites = async (app) => {
@@ -6198,7 +6192,6 @@ function transportConformance(options) {
6198
6192
  }, staticMember(options.transport, "defaultAccessFor") === false && !options.invokeEntities ? "the transport nests no handlers, so it serves no federation reference resolvers" : void 0);
6199
6193
  return cases;
6200
6194
  }
6201
- //#endregion
6202
6195
  export { PROBE_TRUSTED_ORIGIN, conformanceProbePlugin, createConformanceAuth, httpPlatformConformance, policyConformance, principalSourceConformance, runConformance, transportConformance };
6203
6196
 
6204
6197
  //# sourceMappingURL=conformance.mjs.map