@server/next 0.47.1 → 0.47.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 (3) hide show
  1. package/index.d.ts +2 -2
  2. package/index.js +5 -5
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -212,7 +212,7 @@ type AuthConfig<U = AuthProfile> = {
212
212
  onLogout?: (id: string, ctx: Context) => Awaitable<void>;
213
213
  };
214
214
  type AuthVerify<U = AuthClaims> = {
215
- verify: string;
215
+ issuer: string;
216
216
  audience: string | readonly string[];
217
217
  cookie?: string;
218
218
  audienceClaim?: string | readonly string[];
@@ -228,7 +228,7 @@ type AuthOption = string | AuthFunction | AuthConfig<any> | AuthVerify<any> | Au
228
228
  type UserOf<A> = A extends readonly (infer M)[] ? UserOf<M> : A extends (...args: any[]) => infer R ? NonNullable<Awaited<R>> : A extends {
229
229
  getUser: (...args: any[]) => infer R;
230
230
  } ? NonNullable<Awaited<R>> : A extends {
231
- verify: any;
231
+ issuer: any;
232
232
  } ? AuthClaims : A extends {
233
233
  providers: any;
234
234
  } ? AuthProfile : A extends string ? AuthProfile : never;
package/index.js CHANGED
@@ -1572,11 +1572,11 @@ var bearer2 = (ctx) => {
1572
1572
  return token;
1573
1573
  };
1574
1574
  function entry2(options) {
1575
- const { verify: issuer, audience } = options;
1575
+ const { issuer, audience } = options;
1576
1576
  const claimNames = options.audienceClaim ? Array.isArray(options.audienceClaim) ? options.audienceClaim : [options.audienceClaim] : ["aud"];
1577
1577
  if (!audience) {
1578
1578
  throw new Error(
1579
- "`verify` needs an `audience`: one issuer serves many applications, and without it a token minted for another one is accepted here."
1579
+ "`issuer` needs an `audience`: one issuer serves many applications, and without it a token minted for another one is accepted here."
1580
1580
  );
1581
1581
  }
1582
1582
  const allowed = Array.isArray(audience) ? audience : [audience];
@@ -1697,7 +1697,7 @@ function vendorEntry(strategy, name) {
1697
1697
  );
1698
1698
  }
1699
1699
  return entry2({
1700
- verify: issuer,
1700
+ issuer,
1701
1701
  audience,
1702
1702
  ...vendor.claim ? { audienceClaim: vendor.claim } : {},
1703
1703
  ...strategy === "cookie" ? { cookie: vendor.cookie } : {}
@@ -1718,7 +1718,7 @@ function toEntry(auth2) {
1718
1718
  return [{ name: "function", user: async (ctx) => auth2(ctx) }];
1719
1719
  }
1720
1720
  if (auth2 && typeof auth2 === "object") {
1721
- if ("verify" in auth2) return [entry2(auth2)];
1721
+ if ("issuer" in auth2) return [entry2(auth2)];
1722
1722
  if ("providers" in auth2) return [entry(auth2)];
1723
1723
  if ("handler" in auth2) {
1724
1724
  const instance = auth2;
@@ -1750,7 +1750,7 @@ function toEntry(auth2) {
1750
1750
  }
1751
1751
  }
1752
1752
  throw new Error(
1753
- "Invalid `auth`: it takes a string, a function, `{ providers }`, `{ verify, audience }`, a library instance, or an array of those."
1753
+ "Invalid `auth`: it takes a string, a function, `{ providers }`, `{ issuer, audience }`, a library instance, or an array of those."
1754
1754
  );
1755
1755
  }
1756
1756
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@server/next",
3
- "version": "0.47.1",
3
+ "version": "0.47.2",
4
4
  "description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
5
5
  "homepage": "https://server-js.com/",
6
6
  "repository": "github:franciscop/server-next",