@better-auth/cimd 1.7.0-beta.5 → 1.7.0-beta.6

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.
package/dist/index.d.mts CHANGED
@@ -74,8 +74,9 @@ type CimdResolver = (ctx: GenericEndpointContext, clientId: string, existing: Sc
74
74
  * Build the `resolve` function for a CIMD {@link ClientDiscovery}.
75
75
  *
76
76
  * Exposed for advanced composition. Most users should call
77
- * {@link cimdClientDiscovery} (to pass a complete discovery to
78
- * `oauthProvider({ clientDiscovery })`) or install the `cimd()` plugin.
77
+ * {@link cimdClientDiscovery} (to contribute a complete discovery through
78
+ * `oauthProvider({ extensions: [{ clientDiscovery }] })`) or install the
79
+ * `cimd()` plugin.
79
80
  */
80
81
  declare function createCimdResolver(cimdOptions?: CimdOptions): CimdResolver;
81
82
  //#endregion
@@ -118,12 +119,12 @@ declare module "@better-auth/core" {
118
119
  /**
119
120
  * Build a {@link ClientDiscovery} for Client ID Metadata Documents.
120
121
  *
121
- * Users who prefer explicit composition can pass the result directly to
122
- * `oauthProvider({ clientDiscovery })`; most users should install the
123
- * {@link cimd} plugin instead, which appends this discovery to whatever
124
- * is already configured.
122
+ * Users who prefer explicit composition can contribute the result through
123
+ * `oauthProvider({ extensions: [{ clientDiscovery }] })`; most users should
124
+ * install the {@link cimd} plugin instead, which contributes this discovery
125
+ * alongside whatever else is configured.
125
126
  */
126
- declare function cimdClientDiscovery(options?: CimdOptions): ClientDiscovery<Scope[]>;
127
+ declare function cimdClientDiscovery(options?: CimdOptions): ClientDiscovery;
127
128
  /**
128
129
  * Client ID Metadata Document plugin.
129
130
  *
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
+ import { checkOAuthClient, extendOAuthProvider, oauthToSchema } from "@better-auth/oauth-provider";
1
2
  import { BetterAuthError } from "@better-auth/core/error";
2
3
  import { toExpJWT } from "better-auth/plugins";
3
- import { checkOAuthClient, oauthToSchema } from "@better-auth/oauth-provider";
4
4
  import { APIError } from "better-call";
5
5
  //#region src/validate-metadata-document.ts
6
6
  const DOT_SEGMENT_RE = /\/\.\.?(?:\/|$|#|\?)/;
@@ -538,8 +538,9 @@ function isStale(existing, refreshRate) {
538
538
  * Build the `resolve` function for a CIMD {@link ClientDiscovery}.
539
539
  *
540
540
  * Exposed for advanced composition. Most users should call
541
- * {@link cimdClientDiscovery} (to pass a complete discovery to
542
- * `oauthProvider({ clientDiscovery })`) or install the `cimd()` plugin.
541
+ * {@link cimdClientDiscovery} (to contribute a complete discovery through
542
+ * `oauthProvider({ extensions: [{ clientDiscovery }] })`) or install the
543
+ * `cimd()` plugin.
543
544
  */
544
545
  function createCimdResolver(cimdOptions = {}) {
545
546
  const refreshRate = cimdOptions.refreshRate ?? "60m";
@@ -555,16 +556,16 @@ function createCimdResolver(cimdOptions = {}) {
555
556
  }
556
557
  //#endregion
557
558
  //#region src/version.ts
558
- const PACKAGE_VERSION = "1.7.0-beta.5";
559
+ const PACKAGE_VERSION = "1.7.0-beta.6";
559
560
  //#endregion
560
561
  //#region src/index.ts
561
562
  /**
562
563
  * Build a {@link ClientDiscovery} for Client ID Metadata Documents.
563
564
  *
564
- * Users who prefer explicit composition can pass the result directly to
565
- * `oauthProvider({ clientDiscovery })`; most users should install the
566
- * {@link cimd} plugin instead, which appends this discovery to whatever
567
- * is already configured.
565
+ * Users who prefer explicit composition can contribute the result through
566
+ * `oauthProvider({ extensions: [{ clientDiscovery }] })`; most users should
567
+ * install the {@link cimd} plugin instead, which contributes this discovery
568
+ * alongside whatever else is configured.
568
569
  */
569
570
  function cimdClientDiscovery(options = {}) {
570
571
  return {
@@ -591,10 +592,7 @@ const cimd = (options = {}) => {
591
592
  id: "cimd",
592
593
  version: PACKAGE_VERSION,
593
594
  init(ctx) {
594
- const provider = ctx.getPlugin("oauth-provider");
595
- if (!provider) throw new BetterAuthError("The cimd plugin requires the oauth-provider plugin.");
596
- const existing = provider.options.clientDiscovery;
597
- provider.options.clientDiscovery = Array.isArray(existing) ? [...existing, discovery] : existing ? [existing, discovery] : discovery;
595
+ extendOAuthProvider(ctx, { clientDiscovery: discovery });
598
596
  }
599
597
  };
600
598
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/cimd",
3
- "version": "1.7.0-beta.5",
3
+ "version": "1.7.0-beta.6",
4
4
  "description": "Client ID Metadata Document plugin for Better Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -48,15 +48,15 @@
48
48
  "devDependencies": {
49
49
  "listhen": "^1.9.0",
50
50
  "tsdown": "0.21.1",
51
- "@better-auth/core": "1.7.0-beta.5",
52
- "@better-auth/oauth-provider": "1.7.0-beta.5",
53
- "better-auth": "1.7.0-beta.5"
51
+ "@better-auth/core": "1.7.0-beta.6",
52
+ "@better-auth/oauth-provider": "1.7.0-beta.6",
53
+ "better-auth": "1.7.0-beta.6"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "better-call": "1.3.6",
57
- "@better-auth/core": "^1.7.0-beta.5",
58
- "@better-auth/oauth-provider": "^1.7.0-beta.5",
59
- "better-auth": "^1.7.0-beta.5"
57
+ "@better-auth/core": "^1.7.0-beta.6",
58
+ "@better-auth/oauth-provider": "^1.7.0-beta.6",
59
+ "better-auth": "^1.7.0-beta.6"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsdown",