@nerdfolio/ba-guest-list 0.0.7 → 0.0.8

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.cjs CHANGED
@@ -25,6 +25,14 @@ __export(index_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(index_exports);
27
27
 
28
+ // src/client.ts
29
+ var guestListClient = () => {
30
+ return {
31
+ id: "guest-list",
32
+ $InferServerPlugin: {}
33
+ };
34
+ };
35
+
28
36
  // src/server.ts
29
37
  var import_api = require("better-auth/api");
30
38
  var import_cookies = require("better-auth/cookies");
@@ -32,10 +40,10 @@ var import_v4_mini = require("zod/v4-mini");
32
40
 
33
41
  // src/utils.ts
34
42
  var import_lodash_es = require("lodash-es");
35
- function getOrigin(url) {
43
+ function getHost(url) {
36
44
  try {
37
45
  const parsedUrl = new URL(url);
38
- return parsedUrl.origin;
46
+ return parsedUrl.host;
39
47
  } catch (_error) {
40
48
  return null;
41
49
  }
@@ -118,7 +126,7 @@ var guestList = (options) => {
118
126
  message: options?.revealNames ? `Name not on list. Try: ${JSON.stringify(Object.keys(guestLookup))}` : ERROR_CODES.NAME_NOT_ON_GUEST_LIST
119
127
  });
120
128
  }
121
- const { emailDomainName = getOrigin(ctx.context.baseURL) } = options ?? {};
129
+ const { emailDomainName = getHost(ctx.context.baseURL) } = options ?? {};
122
130
  const email = `${cleanedName.toLowerCase().replaceAll(/\s/g, "")}.onguestlist@${emailDomainName}`;
123
131
  const found = await ctx.context.internalAdapter.findUserByEmail(email);
124
132
  async function createNewUser() {
@@ -187,14 +195,6 @@ var guestList = (options) => {
187
195
  $ERROR_CODES: ERROR_CODES
188
196
  };
189
197
  };
190
-
191
- // src/client.ts
192
- var guestListClient = () => {
193
- return {
194
- id: "guest-list",
195
- $InferServerPlugin: {}
196
- };
197
- };
198
198
  // Annotate the CommonJS export names for ESM import in node:
199
199
  0 && (module.exports = {
200
200
  guestList,
package/dist/index.mjs CHANGED
@@ -1,3 +1,11 @@
1
+ // src/client.ts
2
+ var guestListClient = () => {
3
+ return {
4
+ id: "guest-list",
5
+ $InferServerPlugin: {}
6
+ };
7
+ };
8
+
1
9
  // src/server.ts
2
10
  import { APIError, createAuthEndpoint } from "better-auth/api";
3
11
  import { setSessionCookie } from "better-auth/cookies";
@@ -5,10 +13,10 @@ import { z } from "zod/v4-mini";
5
13
 
6
14
  // src/utils.ts
7
15
  import { capitalize } from "lodash-es";
8
- function getOrigin(url) {
16
+ function getHost(url) {
9
17
  try {
10
18
  const parsedUrl = new URL(url);
11
- return parsedUrl.origin;
19
+ return parsedUrl.host;
12
20
  } catch (_error) {
13
21
  return null;
14
22
  }
@@ -91,7 +99,7 @@ var guestList = (options) => {
91
99
  message: options?.revealNames ? `Name not on list. Try: ${JSON.stringify(Object.keys(guestLookup))}` : ERROR_CODES.NAME_NOT_ON_GUEST_LIST
92
100
  });
93
101
  }
94
- const { emailDomainName = getOrigin(ctx.context.baseURL) } = options ?? {};
102
+ const { emailDomainName = getHost(ctx.context.baseURL) } = options ?? {};
95
103
  const email = `${cleanedName.toLowerCase().replaceAll(/\s/g, "")}.onguestlist@${emailDomainName}`;
96
104
  const found = await ctx.context.internalAdapter.findUserByEmail(email);
97
105
  async function createNewUser() {
@@ -160,14 +168,6 @@ var guestList = (options) => {
160
168
  $ERROR_CODES: ERROR_CODES
161
169
  };
162
170
  };
163
-
164
- // src/client.ts
165
- var guestListClient = () => {
166
- return {
167
- id: "guest-list",
168
- $InferServerPlugin: {}
169
- };
170
- };
171
171
  export {
172
172
  guestList,
173
173
  guestListClient
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerdfolio/ba-guest-list",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Similar to anonymous, but with a name that must be on a guest list. Useful for testing or demo with fixed logins",
5
5
  "repository": "https://github.com/nerdfolio/better-auth-goodies",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { guestList, type GuestListOptions } from "./server"
2
- export { guestListClient } from "./client"
1
+ export { guestListClient } from "./client"
2
+ export { type GuestListOptions, guestList } from "./server"
package/src/server.ts CHANGED
@@ -2,7 +2,7 @@ import type { BetterAuthPlugin } from "better-auth"
2
2
  import { APIError, createAuthEndpoint } from "better-auth/api"
3
3
  import { setSessionCookie } from "better-auth/cookies"
4
4
  import { z } from "zod/v4-mini"
5
- import { formatName, getOrigin } from "./utils"
5
+ import { formatName, getHost } from "./utils"
6
6
 
7
7
  type GuestWithRole = {
8
8
  name: string
@@ -121,7 +121,7 @@ export const guestList = (options?: GuestListOptions) => {
121
121
  }
122
122
 
123
123
  // generate email based the input name
124
- const { emailDomainName = getOrigin(ctx.context.baseURL) } = options ?? {}
124
+ const { emailDomainName = getHost(ctx.context.baseURL) } = options ?? {}
125
125
  const email = `${cleanedName.toLowerCase().replaceAll(/\s/g, "")}.onguestlist@${emailDomainName}`
126
126
 
127
127
  const found = await ctx.context.internalAdapter.findUserByEmail(email)
package/src/utils.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { capitalize } from "lodash-es"
2
2
 
3
- export function getOrigin(url: string) {
3
+ export function getHost(url: string) {
4
4
  try {
5
5
  const parsedUrl = new URL(url)
6
- return parsedUrl.origin
6
+ return parsedUrl.host
7
7
  } catch (_error) {
8
8
  return null
9
9
  }